num = 0 day = [] for i in xrange(1,31): s = str(i) for j in s: num += int(j) day.append(num) num = 0 month = [i for i in xrange(1,13)] ans = 0 for i in month: for j in day: if i == j: ans += 1 print ans