import calendar print(sum([ sum([ (m==sum(int(x) for x in str(d))) for d in range(1,int(calendar.month(2015, m).split()[-1])) ] ) for m in range(1,13) ] ))