n = list(input().split()) a = int(n[0]) b = int(n[1]) if b == 23 or a == 25: print(2) elif b >= 24 or a >= 24: print(1) elif a <= 23 and b >= 25: print(0) else: print(3)