#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]++; } } ans += min(A[0], min(A[1], A[2])); 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]++; } } ans += min(min(N-1, A[0]), min(A[1], A[2])); 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]++; } } ans += min(min(N-1, A[0]), min(A[1], A[2])); cout << ans << endl; }