i = gets.to_i range = 1..i a = range.select{|n| (n % 3 == 0) && (n % 5 == 0)} b = range.select{|n| (n % 3 == 0) ^ (n % 5 == 0)} puts a.size * 4 + b.size * 2