#include "bits/stdc++.h" using namespace std; using ll = int64_t; using ld = long double; using ull = unsigned long long; #define ALL(x) x.begin(),x.end() #define rep(iter,from,to) for(ll iter=from;iter dx{ 1,0,1 }, dy{ 0,1,1 }; //####################################################################### void op(vector vec) { ll size = (ll)vec.size(); for (ll i = 0; i < size - 1; ++i) cout << vec[i] << " "; cout << vec.back() << endl; } void op(vector> vec) { ll height = (ll)vec.size(); ll width = (ll)vec[0].size(); for (ll i = 0; i < height; ++i) { for (ll j = 0; j < width - 1; ++j) cout << vec[i][j] << " "; cout << vec[i].back() << endl; } } void twoText(bool identifier, string outTrue, string outFalse) { if (identifier) cout << outTrue << endl; else cout << outFalse << endl; } void twoText(bool identifier) { if (identifier) cout << "Yes" << endl; else cout << "No" << endl; } template T vecsum(vector& vec) { return accumulate(ALL(vec), (T)0); } template T vecsum(vector& vec, ll K) { ll ret = 0; rep(i, 0, K) ret += vec[i]; return ret; } template struct grid { vector> field; grid(ll height, ll width) { field = vector>(height, vector(width, (T)0)); } void input() { rep(i, 0, field.size()) rep(j, 0, field[i].size()) cin >> field[i][j]; } }; //######################################################################### vector> prime_factorize(ll Num) { ll lim = sqrt(Num) + 1; vector> pr; //pair vector listprime(lim); for (ll i = 0; i < lim; ++i) listprime[i] = true; ll root = sqrt(Num); ll res = Num; for (ll i = 2; i <= root; ++i) { ll expnum = 0; if (listprime[i]) { while (res % i == 0) { res /= i; expnum++; } for (ll j = i * 2; j <= root; j += i) listprime[j] = false; } if (expnum != 0) pr.emplace_back(make_pair(i, expnum)); } if (res != 1) pr.emplace_back(make_pair(res, 1)); return pr; } void solve() { ll N; string s; cin >> N >> s; ll cnt = 0; fore(c, s) { if (c == 'A' || c == 'G' || c == 'C' || c == 'T') cnt++; } if (cnt == 0) { cout << 0 << endl; return; } set pos; rep(i, 1, N + 1) pos.emplace(i); auto it = pos.lower_bound(cnt); ll ans = 0; while (cnt > 0) { auto c = s[*it - 1]; auto next = it; if (c == 'A' || c == 'G' || c == 'C' || c == 'T') { cnt--; next--; } else next++; pos.erase(it); it = next; ans++; } cout << ans << endl; } int main(void) { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(15); solve(); }