require('date') a = Date.new(2015, 1 ,1) b = Date.new(2015,12,31) count = 0 for i in a..b first = i.day % 10 second = i.day / 10 sum = first + second count += 1 if i.month == sum end puts count