let a=Int(readLine()!)!
var s : [String] = []
//var anag : [Character:Int] = [:]
//var chars : [[Character]] = []
var hashchar : [String:Int] = [:]
//var anaglist : [[Character:Int]] = []
//var kotae : [[Character:Int]:Int] = [] 
var tmps : String 

var o = 0

for var i  in 0..<a {
  //s.append(readLine()!)
  //var arr2 = Array(readLine()!.characters )
  //arr2 = arr2.sort()
  tmps = String( readLine()!.characters.sort() )
  //print( String(arr2) )

  //print(chars)
  /*
  for var j in 0..<arr2.count {
    if(  anag[arr2[j]] == nil ) {
      anag[arr2[j]] = 1
    } else {
      anag[arr2[j]] = (anag[arr2[j]])! + 1
    }
  }*/
  
  //print( hashchar[String(arr2)] )
  if( hashchar[tmps] == nil ) {
    hashchar[tmps] = 0
  } else {
    var tmp = ( hashchar[tmps] )! + 1
    hashchar[tmps] = tmp
    o += tmp
  }
  
  //var z = 0

  //chars.append(arr2)
  //anaglist.append( anag )
  
  //print( anag )
  //anag = [:]
}
/*
for var k in 0..<anaglist.count {
  for var x in k+1..<(anaglist.count) {
    if( anaglist[x] == anaglist[k] ){
      o += 1
    }
  }
}
*/
  
print( o )
