#include using namespace std; int main() { int n; string s; cin >> n >> s; set st; for( int i = 0; i < n; i++ ) { if( s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T' ) st.insert( i ); } int ans = 0; int last = -1; int del = 0; while( st.size() ) { int j = st.size() - 1; auto it = st.lower_bound( j ); int a = *it - j + 1; if( last < 0 ) { last = *it; del += a; } else if( *it > last ) { int t = a; a -= del; del = t; last = *it; } else { last = *it; del += a; } ans += a; st.erase( it ); } cout << ans << endl; }