require 'date' puts (Date.new(2015)...Date.new(2016)).count { |d| p d.day.to_s.chars.map(&:to_i).reduce(&:+) == d.month }