"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]) {
            answer = map[temp] + 1;
            map[temp]++;
        } else {
            map[temp] = 1;
        }
    })
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));