import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    static int N;
    static HashMap<String, Long> m;

    private static void init() {
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();

        scanner.nextLine();

        long cnt = 0;
        m = new HashMap<>();
        for(int i = 0; i < N; i++) {
            String line = scanner.nextLine();
            ArrayList<Character> list = new ArrayList<>();
            for(int j = 0; j < 10; j++) {
                list.add(line.charAt(j));
            }
            Collections.sort(list);
            StringBuilder sb = new StringBuilder();
            for(Character c: list) {
                sb.append(c);
            }
            String srt = sb.toString();
            if(m.containsKey(srt)) {
                cnt += m.get(srt);
                m.put(srt, m.get(srt) + 1);
            } else {
                m.put(srt, (long) 1);
            }
        }

        System.out.println(cnt);
        scanner.close();
    }


    public static void main(String args[]) {
        init();
    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz