sum=Array.new() ans=0 for i in 1..31 do sum.push("#{i}".chars[0].to_i+"#{i}".chars[1].to_i) end day31=[1,3,5,7,8,1,3] day30=[4,6,9,2] day28=[2] for i in day31 do ans+=sum.count(i) end for i in day30 do ans+=sum.first(30).count(i) end for i in day28 do ans+=sum.first(28).count(i) end puts ans