N = gets.chomp.to_i count = 0; (1..N).each do |e| count += 2 if e % 3 == 0 count += 2 if e % 5 == 0 end puts count