#include <bits/stdc++.h>
using namespace std;
long long vis[30];
map<string, long long> mp;
vector<string> v;
int main() {
  long long ans;
  long long n, i, j, x = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    memset(vis, 0, sizeof(vis));
    string s, ss = "";
    cin >> s;
    long long len = s.size();
    for (j = 0; j < len; j++) vis[s[j] - 'a']++;
    for (j = 0; j < 26; j++) {
      if (vis[j] % 2 == 1) ss += char(j + 'a');
      vis[j] = 0;
    }
    if (ss.size() == 0)
      x++;
    else {
      mp[ss]++;
      if (mp[ss] == 1) v.push_back(ss);
    }
  }
  ans = x * (x - 1) / 2;
  for (i = 0; i < v.size(); i++) {
    string s1 = v[i], s2;
    if (s1.size() == 1) ans += x * mp[s1];
    ans += mp[s1] * (mp[s1] - 1) / 2;
    for (j = 0; j < s1.size(); j++) {
      s2 = s1;
      s2.erase(j, 1);
      if (mp[s2] > 0) ans += mp[s2] * mp[s1];
    }
  }
  cout << ans << endl;
}
