function Main(input) {
    var N = input.split('\n')[0] - 0;

    var cnt = 0;
    for (var i = 0; i < N; i++){
        var a = input.split('\n')[i + 1].split('').sort().join();

        for (var j = i + 1; j < N; j++){
            var b = input.split('\n')[j + 1].split('').sort().join();
            if (a === b) cnt++;
        }
    }

    console.log(cnt);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));