num = gets.to_i count = 0 (1..num).each do |n| if n % 15 == 0 count += 4 elsif n % 3 == 0 count += 2 elsif n % 5 == 0 count += 2 end end print count