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: print(2) elif A <= 23 and B == 24: print(1)