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

void main() {
  ulong count = 0;
  int[string] dict;

  auto N = readln.chomp.to!int;
  foreach (i; 0..N) {
    char[] line = readln.chomp.dup;
    sort(line.representation);
    auto word = line.to!string;

    if (!(word in dict)) {
      dict[word] = 1;
      continue;
    }
    count += dict[word]++;
  }

  write(count);
}
