#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, a[100002], q, k, ind, ans, erk[35], qan[100002], qani;
map<long long, long long> klt;
char c[1000002];
int main() {
  cin >> n;
  for (long long i = 0; i < (long long)n; i++) {
    cin >> c;
    k = strlen(c);
    sort(c, c + k);
    ind = 1;
    for (long long j = (long long)1; j < (long long)k; j++) {
      if (c[j] == c[j - 1])
        ind++;
      else {
        a[i] += ((ind % 2) * pow(3, (c[j - 1] - 'a')));
        ind = 1;
      }
    }
    a[i] += ((ind % 2) * pow(3, (c[k - 1] - 'a')));
    klt[a[i]]++;
  }
  sort(a, a + n);
  qan[qani++] = a[0];
  for (long long i = (long long)1; i < (long long)n; i++) {
    if (a[i] != a[i - 1]) qan[qani++] = a[i];
  }
  for (long long i = 0; i < (long long)qani; i++) {
    ans += ((klt[qan[i]] * (klt[qan[i]] - 1)) / 2);
  }
  erk[0] = 1LL;
  for (long long i = (long long)1; i < (long long)30; i++)
    erk[i] = erk[i - 1] * 3;
  for (long long i = 0; i < (long long)qani; i++) {
    for (long long j = 0; j < (long long)30; j++) {
      ans += ((klt[qan[i]] * klt[qan[i] + erk[j]]));
    }
  }
  cout << ans << endl;
  return 0;
}
