local mmi, mma = math.min, math.max local n = io.read("*n", "*l") local rawn = n n = n * 3 local s = io.read() local x, y, z = {0,0,0},{0,0,0},{0,0,0} for i = 1, n do local si = s:sub(i, i) if si == "c" then if i % 3 == 1 then x[1] = x[1] + 1 elseif i % 3 == 2 then x[2] = x[2] + 1 else x[3] = x[3] + 1 end elseif si == "o" then if i % 3 == 2 then y[1] = y[1] + 1 elseif i % 3 == 0 then y[2] = y[2] + 1 else y[3] = y[3] + 1 end elseif si == "n" then if i % 3 == 0 then z[1] = z[1] + 1 elseif i % 3 == 1 then z[2] = z[2] + 1 else z[3] = z[3] + 1 end end end local a, b, c = mmi(x[1],y[1],z[1]), mmi(x[2],y[2],z[2]), mmi(x[3],y[3],z[3]) local ret = a + b + c local need = a if 0 < b + c then need = a + 1 + b + c end if rawn < need then ret = ret - (need - rawn) end print(ret)