#include<iostream>
#include<string>

using namespace std;

int main(){
	
	int n;
	string s;

	cin >> n >> s;

	int ans = 0;

	for(int l = 2; l <= n; l = l + 2){
		int anum = 0, tnum = 0, cnum = 0, gnum =0;

		string t = s.substr(0, l);
		for(int i = 0, size = t.size(); i < size; ++i){
			switch (t[i]){
				case 'A': ++anum; break;
				case 'T': ++tnum; break;
				case 'C': ++cnum; break;
				case 'G': ++gnum; break;
				default: break;
			}
		}

		if((anum == tnum)&&(cnum == gnum))++ans;

		for(int i = 1; i + l <= n; ++i){
			switch (s[i-1]){
				case 'A': --anum; break;
				case 'T': --tnum; break;
				case 'C': --cnum; break;
				case 'G': --gnum; break;
				default: break;
			}
			switch (s[i + l -1]){
				case 'A': ++anum; break;
				case 'T': ++tnum; break;
				case 'C': ++cnum; break;
				case 'G': ++gnum; break;
				default: break;
			}

			if((anum == tnum)&&(cnum == gnum))++ans;
		}
	}

	cout << ans;
	fflush(stdout);
	return 0;
}
/*
"An anomaly, I'm Muhammad Ali
  Cause I know one day I'm gonna be the"
                - Greatest, Eminem
*/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;



int main(){
    Shazam;
    ll n, x; cin >> n >> x;
    string s; cin >> s;
    for(char c : s){
        x = max(0LL, x + ((c=='x')?-1:1));
    }
    cout << x << endl;
    return 0;
}