def get_data(): A,B = map(int,input().split()) return A,B def solve(A,B): if A == B: if 23 <= A and A <=25: N = 2 return N else: N = 0 return N elif B >=25: if A<=23: N = 0 return N elif A == 24 or A == 25: N = A - 23 return N else : N = 3 return N elif B == 23 or B ==24: N = 25 - B return N else: N = 3 return N def main(): A, B = get_data() N = solve(A, B) print(N) if __name__=='__main__': main()