import std.stdio;
import std.algorithm;
import std.math;
import std.conv;
import std.string;

T readNum(T)(){
  return readStr.to!T;
}

T[] readNums(T)(){
  return readStr.split.to!(T[]);
}

string readStr(){
  return readln.chomp;
}

void main(){
  auto n = readNum!int;
  auto str = new string[](n);
  foreach(ref s; str){
    s = sort(readStr.representation.dup).to!string;
  }

  int ret;
  sort(str);

  auto g = str.group;
  foreach(ref e; g){
    ret += e[1] * (e[1] - 1) / 2;
  }

  writeln(ret);
}
