#include using namespace std; int f(vector>& freq, int k) { int res = 1<<30; for( int i = 0; i < 3; i++ ) { res = min(res, freq[(k+i)%3][i]); } return res; } int main() { int N; string s; cin >> N >> s; vector> freq(3, vector(3)); for( int i = 0; i < 3*N; i++ ) { char c = s[i]; if( c == 'c' ) freq[i%3][0]++; else if( c == 'o' ) freq[i%3][1]++; else if( c == 'n' ) freq[i%3][2]++; } int len = 0, ans = 0; for( int i = 0; i < 3; i++ ) { int k = f(freq, i); if( len+3*k <= 3*N ) { ans += k; len += 3*k+1; }else { ans += (3*N-len)/3; cout << ans << endl; return 0; } } cout << ans << endl; }