function Main(input){
    const sn = input.split('\n');
    const N = sn.shift();
    let answer = 0;
    let box = new Map();
    for(let i=0; i<sn.length; i++){
        const sortStr = sn[i].split('').sort().join('').trim();
        if(box.has(sortStr)){
            answer += box.get(sortStr);
            box.set(sortStr, box.get(sortStr)+1)
        } else{
            box.set(sortStr, 1);
        }
    }
    console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
