c = 0 for m in range(1,13): for d in range(1,32): if m == int(d/10 + d%10) and not(m == 4 and d == 31): c += 1 print(c)