import math cnt = 0 for month in range(1,12+1): if month ==4 or month == 6 or month ==9 or month == 11: daymax = 30 elif month == 2: daymax = 28 else: daymax = 31 for day in range(1,daymax+1): if month == math.floor(day/10) + day%10: cnt=cnt+1 print(cnt)