from datetime import date,timedelta ans = 0 s = date(2015,1,1) for i in range(365): x = s + timedelta(days=i) m = x.month // 10 + x.month % 10 d = x.day // 10 + x.day % 10 if m == d: ans += 1 print(ans)