import datetime m, d = [int(x) for x in input().split()] today = datetime.date(2024, m, d) birth = datetime.date(2000, 8, 23) delta = today - birth print(int((delta.days - 5) / 365))