month = [i for i in range(1, 13)] date = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] s = 0 for month in range(1, 13): for d in range(1, date[month-1]+1): a = d // 10 #日付10の位 b = d - a*10 #日付1の位 if month == a+b: s = s+1 print(s)