var ToSource = (obj) => {
  return Object.keys(obj).sort().reduce((i,e)=>{
    return i + e + ":" + obj[e] + ",";
  },"");
};
var input = require('fs').readFileSync('/dev/stdin', 'utf8').split("\n");
input.shift();
input = input.map((s)=>{
  var charmap = {};
  var achar = s.split("");
  achar.forEach((c)=>{ 
    if (charmap[c] === undefined) charmap[c]=0;
    charmap[c] += 1; 
  }); 
  return ToSource(charmap);  
});
var counted = input.map(()=>{return 0;});
for(var i = 0; i < counted.length; i++) {
  if(counted[i] != 0) continue;
  for(var j = i+1; j < counted.length; j++) {
    if(counted[j] != 0) continue;
    if(input[i] == input[j]) {
      counted[j] = 1;
      counted[i] = 1;
    }
  }
}
console.log(counted.reduce((i,e)=>{return i+e;}));
