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;

void main() {
    int n; scan(n);
    string[] ss;
    foreach (_; 0..n) {
        string s = read!string;
        auto t = s.array;
        t.sort();
        ss ~= t.to!string;
    }

    ss.sort();
    int ans = 0;
    int p = 0;
    while (p+1 < ss.length) {

        if (ss[p] == ss[p+1]) {
            int q = p + 1;
            while (q + 1 < ss.length && ss[p] == ss[q + 1]) {
                q++;
            }

            int k = q - p + 1;
            ans += (k * (k - 1)) / 2;
            p = q + 1;
        }
        else {
            p++;
        }
    }

    writeln(ans);
}
