#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long i, j, n, ans = 0;
  cin >> n;
  string s, t;
  map<string, long long> m, m1;
  map<string, long long>::iterator it;
  for (i = 0; i < n; ++i) {
    cin >> s;
    t = "";
    long long a[26] = {0};
    for (j = 0; j < s.size(); ++j) a[s[j] - 'a']++;
    for (j = 0; j < 26; ++j)
      if (a[j] & 1) t += (char)('a' + j);
    m[t]++;
  }
  m1 = m;
  for (it = m.begin(); it != m.end(); ++it) {
    s = it->first;
    ans += (it->second) * (it->second - 1) / 2;
    for (i = 'a'; i <= 'z'; ++i) {
      t = s + (char)(i);
      sort(t.begin(), t.end());
      ans += (it->second) * (m1[t]);
    }
  }
  cout << ans;
  return 0;
}
