#include using namespace std; int A[3]; int main() { int N; string S; cin >> N >> S; int ans = 0; for (int i = 0; i < 3*N; i++) { if (i%3 == 0) { if (S[i] == 'c') A[0]++; } else if (i%3 == 1) { if (S[i] == 'o') A[1]++; } else { if (S[i] == 'n') A[2]++; } } int ans1 = min(A[0], min(A[1], A[2])); ans += ans1; for (int i = 0; i < 3; i++) A[i] = 0; for (int i = 0; i < 3*N; i++) { if (i%3 == 0) { if (S[i] == 'n') A[0]++; } else if (i%3 == 1) { if (S[i] == 'c') A[1]++; } else { if (S[i] == 'o') A[2]++; } } int ans2 = min(A[0], min(A[1], A[2])); ans += ans2; for (int i = 0; i < 3; i++) A[i] = 0; for (int i = 0; i < 3*N; i++) { if (i%3 == 0) { if (S[i] == 'o') A[0]++; } else if (i%3 == 1) { if (S[i] == 'n') A[1]++; } else { if (S[i] == 'c') A[2]++; } } int ans3 = min(A[0], min(A[1], A[2])); ans += ans3; if (ans2 > 0 || ans3 > 0) ans -= max(0, 1 - (N-ans)); cout << ans << endl; }