"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const S = arg.slice(1, N + 1).map(s=>s.split(""));
    
    const map = {};
    let answer = 0;
    
    // Sを辞書順ソートする
    S.forEach(s => {
        s.sort();
        let temp = s.join("");
        
        if(map[temp]) {
            map[temp]++;
            answer = map[temp] + 1;
        } else {
            map[temp] = 1;
        }
    })
    
    // カウントが2以上のやつだけ考慮して組み合わせ数をanswerに足す
    for(let key of Object.keys(map)) {
        if(map[key] > 1) {
            let temp = [...Array(map[key])].fill(0)
            //answer += combineWithoutRepetitions(temp, 2).length;
        }
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));