package main

import (
	"fmt"
	"sort"
)

func ssort(s string) string {
	r0 := make([]string, 0)
	for i := 0; i < len(s); i++ {
		r0 = append(r0, string(s[i]))
	}
	sort.Strings(r0)
	r1 := ""
	for i := 0; i < len(s); i++ {
		r1 += string(r0[i])
	}
	return r1
}

func main() {
	var N int
	fmt.Scan(&N)
	m := make(map[string][]int)
	for i := 0; i < N; i++ {
		s0 := ""
		fmt.Scan(&s0)
		s1 := ssort(s0)
		m[s1] = append(m[s1], i)
	}
	// fmt.Println("N", N, "m", m)
	ans := 0
	for _, v := range m {
		vl := len(v)
		if vl >= 2 {
			ans += (vl - 1) * vl / 2
		}
	}
	fmt.Println(ans)
}
