#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll LL_MAX=LLONG_MAX;

struct In{
    template<typename T>
    operator T(){
        T x;
        cin >> x;
        return x;
    }
};
In in;

template <typename T,typename U>
void forin(T* x,U n){
    for (U i=0;i<n;i++) cin >> x[i];
}

template <typename T>
int div1(T x) {
    return x%1000000007;
}

template <typename T>
void out(T x){
    cout << x << endl;
}

template <typename T>
T gcd(T x,T y){
    if (y == 0) return x;
    return gcd(y,x%y);
}

template <typename T>
T lcm(T x,T y){
    return x*y/gcd(x,y);
}

int main(){
    int n=in;
    string s=in;
    int at,cg,ans=0;
    for (int i=0;i<n;i++){
        at=0;
        cg=0;
        if (s[i]=='A') at++;
        else if (s[i]=='T') at--;
        else if (s[i]=='C') cg++;
        else if (s[i]=='G') cg--;        
        for (int i2=i+1;i2<n;i2++){
            if (s[i2]=='A') at++;
            else if (s[i2]=='T') at--;
            else if (s[i2]=='C') cg++;
            else if (s[i2]=='G') cg--;
            if (at==0 && cg==0) ans++;
        }
    }
    out(ans);
}

#include <bits/stdc++.h>
using namespace std;
#define mp   make_pair
#define pb   push_back
#define eb   emplace_back
#define f first
#define s second
#define fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define int  long long
#define endl "\n"
#define yn(b) cout << &("NO\n\0YES\n"[4*b]);
#define show(a) {for(auto x:a) cout << x << " "; cout << endl;}
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
void solve(){
	int n;
	cin >> n;
	int ans = n/100;
	if(n%100!=0) ans++;
	cout << ans << endl;
}

int32_t main(){
	fast;
	int t;
  	//cin >> t;
	t=1;
  	while(t--){
		solve();
  	}
}
