require 'date' S,T = ["2015-01-01","2015-12-31"].map{|d| Date.parse(d) } puts (S .. T).count{|d|d.month == (d.day / 10 + d.day % 10) }