#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; string s; cin >> s; vector> cnt(3, vector(3)); string sub = "con"; for (int i = 0; i < 3 * n; i++) { for (int j = 0; j < 3; j++) { if (s[i] == sub[j]) { cnt[(i + 3 - j) % 3][j]++; } } } int ans = 0, msk; for (int i = 0; i < 3; i++) { int x = *min_element(cnt[i].begin(), cnt[i].end()); if (x > 0) { ans += x; msk ^= (1 << i); } } cout << min(ans, n - (__builtin_popcount(msk) > 1)); }