#include <bits/stdc++.h>
using namespace std;
map<int, int> hashing_count;
int xuli(vector<char> a) {
  int kq = 0;
  for (auto item : a) {
    kq += 1 << (item - 'a');
  }
  return kq;
}
long long nhich(int value, vector<char> my_stack) {
  long long res = 0;
  for (auto kitu : my_stack) {
    int cur_value = value - (1 << (kitu - 'a'));
    res += hashing_count[cur_value];
  }
  for (int bit = 0; bit < 26; bit++) {
    if (!(value & (1 << bit))) {
      int cur_value = value + (1 << bit);
      res += hashing_count[cur_value];
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  vector<char> my_stack;
  int n;
  cin >> n;
  cin.ignore();
  int du0_count = 0, du1_count = 0;
  long long kq = 0;
  for (int loop = 1; loop <= n; loop++) {
    string s;
    cin >> s;
    cin.ignore();
    sort(s.begin(), s.end());
    my_stack.clear();
    for (auto item : s) {
      if (my_stack.empty() || my_stack.back() != item)
        my_stack.push_back(item);
      else
        my_stack.pop_back();
    }
    if (my_stack.empty()) {
      kq += du0_count;
      kq += du1_count;
      du0_count++;
    }
    if (my_stack.size() == 1) {
      kq += du0_count;
      int value = xuli(my_stack);
      kq += hashing_count[value];
      hashing_count[value]++;
      du1_count++;
    }
    if (my_stack.size() > 1) {
      int value = xuli(my_stack);
      kq += hashing_count[value];
      hashing_count[value]++;
    }
    if (my_stack.size() > 0) {
      int value = xuli(my_stack);
      kq += nhich(value, my_stack);
    }
  }
  cout << kq;
}
