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