days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] count = 0 for m in range(1, 13): for d in range(1, days[m-1]+1): if m == d//10 + d % 10: count += 1 print(count)