N=gets.chomp.to_i def fizzbuzz(n) str = "" if n % 3 == 0 and n % 5 == 0 str = "FizzBuzz" elsif n % 3 == 0 str = "Fizz" elsif n % 5 == 0 str = "Buzz" else str = n.to_s end return str end str = "" for num in 1..N str += fizzbuzz(num) end c = 0 for num in 0..(str.length - 1 ) if str[num] == "z" c += 1 end end puts c