puts (0..11).map{|i| (1..31-[0,3,0,1,0,1,0,0,1,0,1,0][i]).map{|j|j.divmod(10)}.count{|j| i+1==j[0]+j[1] } }.sum