The input contains two integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub> (0 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 32), separated by a single space.
a, b = map(int, input().split())
d = [0]*33
for i in range(1, 32):
    if d[i] == 0:
        for j in range(i*2, 33, i):
            d[j] = 1

if (d[a] == 0 and d[b] == 0) or (d[a] == 1 and d[b] == 1):
    print(0)
else:
    print(1)