import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long calc(string[] ss) {
    int[string] d;
    foreach (s; ss) {
        auto t = s.array;
        t.sort();
        d[t.to!string]++;
    }

    long ans = 0;
    foreach (_, v; d) {
        if (v > 1) ans += v * (v - 1) / 2;
    }
    return ans;
}

void main() {
    int n; scan(n);
    string[] ss;
    foreach (_; 0..n) ss ~= read!string;

    writeln(calc(ss));
}
