#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
unsigned long long seed = 131;
unordered_map<unsigned long long, unsigned long long> mp;
unsigned long long p[30];
void init() {
  p[0] = 131;
  for (int i = 1; i <= 26; i++) p[i] = p[i - 1] * seed;
}
char s[N];
int cnt[30];
unsigned long long a[N];
int main() {
  init();
  int n;
  scanf("%d", &n);
  unsigned long long ans = 0;
  unsigned long long num = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    memset(cnt, 0, sizeof(cnt));
    int len = strlen(s);
    for (int j = 0; j < len; j++) {
      cnt[s[j] - 'a']++;
    }
    for (int j = 0; j < 26; j++) {
      cnt[j] %= 2;
      if (cnt[j]) {
        a[i] += p[j];
      }
    }
    ans += mp[a[i]];
    for (int j = 0; j < 26; j++) {
      if (!cnt[j]) {
        unsigned long long temp = a[i] + p[j];
        ans += mp[temp];
      } else {
        unsigned long long temp = a[i] - p[j];
        ans += mp[temp];
      }
    }
    mp[a[i]]++;
  }
  printf("%llu\n", ans);
  return 0;
}
