days = list(range(1,32)) month = list(range(1,12)) result =0 for i in days: for j in month: if i < 10 and i == j: result +=1 elif i//10 + i%10 == j: result +=1 print (result -1)