object Main extends App {
  var a = readInt
  var b = Array.tabulate(a)(i => (readLine).sorted)
  var sum = 0L
  for(i <- 0 until a - 1;j <- i+1 until a) {
    if(b(i) == b(j)) {
      sum = sum + 1
    }
  }
  print(sum)
}