#include<iostream>
#include<cstdio>
#include<fstream>
using namespace std;
const int maxn=1e2+3;
const int maxm=1e4+7;
int n,ans,ch[maxm][maxn];string a;
int main()
{
cin>>n>>a;
for(int i=0;i<n;i++)
for(int j=0;j<=i;j++)ch[i][a[j]-'a']++;
for(int i=0;i<n;i++)
for(int j=i;j<n;j++)
{
bool f=0;
for(int k=0;k<=25;k++)
{
int t;
if(i>0)t=ch[j][k]-ch[i-1][k];
else t=ch[j][k];
if(t&1)
{
f=1;
break;
}
}
ans=(f?ans:ans+1);
}
cout<<ans;
return 0;
}