"use strict";

const input = require("fs").readFileSync("/dev/stdin", "utf8");
const inputs = input.split("\n");

const main = (inputs) => {
    let N = inputs[0];
    let word;
    let wordArr = [];
    let ans = 0;
    let index;

    let countArr = Array(Number(N)).fill(0);
    for (let i = 1; i <= N; i++) {
        word = inputs[i].split("").sort().join("");

        loop: for (let k = 0; k < i; k++) {
            if (wordArr[k] === word) {
                countArr[k]++;
                ans = ans + countArr[k];
                break loop;
            }
        }
        wordArr.push(word);
    }

    return ans;
};

console.log(main(inputs));