#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
string s;
cin >> n >> s;
const int MASK_MAX = 1 << 26;
vector<int> dp(MASK_MAX, 0);
dp[0] = 1;
int mask = 0;
long long ans = 0;
for (char c : s) {
mask ^= (1 << (c - 'a'));
ans += dp[mask];
int temp = mask;
for (int j = 0; j < 26; j) {
temp ^= (1 << j);
ans += dp[temp];
temp ^= (1 << j);
}
dp[mask];
}
cout << ans << '\n';
return 0;
}