a = input() l = a.split(' ') x = int(l[0]) y = int(l[1]) num = 0
for i in (x-1,y): if 2 in i: num += 1
print(num)