counter = 0 day = [31,28,31,30,31,30,31,31,30,31,30,31] 1.upto(12){|m| 1.upto(day[m-1]){|d| counter+=1 if m==d/10+d%10 } } puts counter