var input = require('fs').readFileSync('/dev/stdin', 'utf8').split("\n");
input.shift();
input = input.map((s)=>{
  return s.split("").sort().join("");
});
var counted = input.map(()=>{return 0;});
for(var i = 0; i < counted.length; i++) {
  if(counted[i] != 0) continue;
  var count = 1;
  for(var j = i+1; j < counted.length; j++) {
    if(counted[j] != 0) continue;
    if(input[i] == input[j]) {
      counted[j] = count;
      count++;
    }
  }
}
console.log(counted.reduce((i,e)=>{return i+e;}));
