A, B = map(int, input().split()) if A < 23: if B < 24: print(0) elif B-23 > 3: print(0) else: print(B-23) elif B > 24: print(A-22) else: print(B-A+1)