String.prototype.splitByIndention = function () {
        return this.split('\n');
};
String.prototype.splitBySpace = function () {
        return this.split(' ');
};
Array.prototype.parseIntToEach = function () {
        return this.map(x => Number(x));
};

function factorial(value) {
        return value > 0 ? value * factorial(value - 1) : 1;
}

const input = require('fs').readFileSync('/dev/stdin', 'utf8');

function main(input) {
        const N = Number(input.shift());
        var S = input;

        var S = S.map(x => {
                var result = Array(26).fill(0);
                x = x.split('');
                for (var i = 0; i < x.length; i++) {
                        result[x[i].codePointAt(0) - 97]++;
                }
                return result.join('');
        });

        var result = {};
        for (var i = 0; i < S.length; i++) {
                result[S[i]] = (result[S[i]] || 0) + 1;
        };
  console.log('huga');
  return;

        var total = 0;
        for (key in result) {
                if (result[key] !== 1) {
                        total += factorial(result[key]) / (2 * factorial(result[key] - 2));
                }
        }

        console.log(total);
};

main(input.splitByIndention());