import std.stdio, std.conv, std.string, std.range, std.algorithm, std.range;

void main() {
  auto N = readln.split[0].to!int;
  auto s = new string[N];
  foreach(i; 0..N) {
    s[i] = readln.split[0];
  }

  auto bucket = new int[26][N];
  foreach(i; 0..N) {
    foreach(c; s[i]) {
      bucket[i][c - 'a']++;
    }
  }

  int[int[26]] m;

  ulong ans = 0;
  foreach(b; bucket) {
    if(b in m) {
      ans += m[b];
    }
    m[b]++;
  }
  ans.writeln;
}
