c = 0 for m in range(12): for d in range(31): M = m +1 D = d+1 a,b=map(int, D.split()) if a+b ==M: c += 1 print(c-1)