#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  map<set<char>, long long> ans;
  long long nullcount = 0;
  for (long long i = 0; i < n; i++) {
    string s;
    cin >> s;
    map<char, long long> m;
    for (long long j = 0; j < s.size(); j++) {
      if (m.find(s[j]) == m.end()) {
        m[s[j]] = 1;
      } else
        m[s[j]]++;
    }
    set<char> tmp;
    map<char, long long>::iterator it;
    for (it = m.begin(); it != m.end(); it++) {
      if ((it->second) % 2 == 1) {
        tmp.insert(it->first);
      }
    }
    if (tmp.size() == 0) nullcount++;
    if (ans.find(tmp) == ans.end())
      ans[tmp] = 1;
    else
      ans[tmp]++;
  }
  long long fans = 0;
  map<set<char>, long long>::iterator it;
  for (it = ans.begin(); it != ans.end(); it++) {
    if ((it->first).size() == 0) {
      long long x = it->second;
      fans += (x * (x - 1)) / 2;
    } else {
      if (it->second > 1) {
        long long x = it->second;
        fans += (x * (x - 1)) / 2;
      }
      if ((it->first).size() == 1) {
        fans += nullcount * (it->second);
      }
    }
    if ((it->first).size() > 1) {
      set<char>::iterator it1;
      set<char> sg = it->first;
      for (it1 = sg.begin(); it1 != sg.end(); it1++) {
        set<char> stmp = sg;
        stmp.erase(*it1);
        if (ans.find(stmp) != ans.end()) {
          long long xtmp = ans[stmp];
          fans += xtmp * (it->second);
        }
      }
    }
  }
  cout << fans << '\n';
  ;
}
