Loading Similar Posts
#include <bits/stdc++.h>
#include <algorithm>
#include <stack>
using namespace std;
#define pb push_back
#define ll long long int
#define MAXN 1000001
#define MOD 1000000007
int main() {
int n;
cin >> n;
string s;
cin >> s;
int freq[26] = {0};
for (int i = 0; i < n; i++)
{
freq[s[i] - 'a']++;
}
int ans = 0;
for (int i = 0; i < 26; i++)
{
ans += (freq[i] * freq[25 - i]);
}
cout << (ans / 2) << endl;
return 0;
}