function solve()
    n = parse(Int, readline())
    s = readline()
    s = replace(s, "CPCTCPC" => "CPCTF")
    x = split(s, "CPCTF")
    println(length(x) - 1)
end
solve()