function main(input) {
    var args = input.trim().split("\n");
    var N = parseInt(args[0]);
    var Ss = args.filter((v, i) => i !== 0);

    var resultMap = Ss.map((v) => {
        var sorted = v.split("").sort();
        return sorted.join("");
    }).reduce((accumulator, currentValue) => {
        accumulator[currentValue] = !!accumulator[currentValue] ? accumulator[currentValue] + 1 : 1;
        return accumulator;
    }, {});

    var result = Object.keys(resultMap).filter((v) => {
        return resultMap[v] > 1
    }).reduce((accumulator, currentValue) => {
        var base = resultMap[currentValue] - 1;
        var value = 0;
        while(base > 0) {
            value += base;
            base--;
        }

        return accumulator + value
    }, 0);

    console.log(result);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));