import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    long ans = 0;
    int [int[300]] cnt;
    while (n--) {
        auto s = readln.chomp;
        int[300] c = new int[300];
        foreach (e; s) { ++c[e]; }
        
        ans += cnt.get(c, 0);
        cnt[c] += 1;
    }
    
    ans.writeln;
}