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('');
        if(box.has(sortStr)){
            answer++;
        }
        box.set(sortStr);
    }
    answer += box.size-1
    console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
