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

void main() {
    int n = readln.chomp.to!int;
    long[string] s;
    foreach (i; 0 .. n) {
        string tmp = readln.split.to!(char[]).sort.to!string;
        if (tmp in s) ++s[tmp];
        else s[tmp] = 0;
    }
    long cnt;
    foreach (val; s.values) {
        cnt += val * (val + 1) / 2;
    }
    cnt.writeln;
}