object Main extends App {
    val num = readInt()
    val input = for (e <- 0 until num) yield readLine()

    val sortedListSize = input.map(_.sorted).toList.size
    val sortedSeqSize = input.map(_.sorted).toSet.size

    val ans = sortedListSize - sortedSeqSize
    println(ans)
}