# -*- coding:utf-8 -*- def solve(n,i): temp = str(n) num = 0 for k in temp: num += int(k) if i == num: return 1 else: return 0 if __name__ == "__main__": num1 = [4,6,9,11] num2 = [1,3,5,7,8,10,12] ans = 0 for i in xrange(1,13): if i in num1: for j in xrange(1,31): ans += solve(j,i) elif i in num2: for j in xrange(1,32): ans += solve(j,i) else: for j in xrange(1,29): ans += solve(j,i) print ans