let a=Int(readLine()!)!
var s : [String] = []
var anag : [Character:Int] = [:]
var anaglist : [[Character:Int]] = []

for var i  in 0..<a {
  //s.append(readLine()!)
  var arr2 = Array(readLine()!.characters )
  for var j in 0..<arr2.count {
    if(  anag[arr2[j]] == nil ) {
      anag[arr2[j]] = 1
    } else {
      anag[arr2[j]] = (anag[arr2[j]])! + 1
    }
  }
  anaglist.append( anag )
  //print( anag )
  anag = [:]
}

var o = 0
for var k in 0..<anaglist.count {
  for var x in k+1..<(anaglist.count) {
    if( anaglist[x] == anaglist[k] ){
      o += 1
    }
  }
}
  
print( o )
