A, B = map(int, input().split()) if B <= 22 or 26 <= A: print(3) elif A <= 23 and 25 <= B: print(0) elif (A <= 23 and B == 23) or (A == 24 and B == 24) or A >= 25: print(2) elif (A <= 23 and B == 24) or (A == 24 and B >= 25): print(1)