import java.io.PrintWriter;
import java.util.*;

public class Main {
    private static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        Map<String, ArrayList<Integer>> map = new HashMap<>();
        for (int i = 0; i < n; ++i) {
            char[] c = in.next().toCharArray();
            Arrays.sort(c);
            String s = new String(c);
            if (!map.containsKey(s)) {
                ArrayList<Integer> list = new ArrayList<>();
                list.add(i);
                map.put(s, list);
            }
            else {
                ArrayList<Integer> list = map.get(s);
                list.add(i);
            }
        }
        long ans = 0;
        Set<String> keySet = map.keySet();
        for (String t : keySet) {
            ArrayList<Integer> list = map.get(t);
            int m = list.size();
            ans += (long)(m - 1) * m / 2;
        }
        out.println(ans);
        out.close();
    }
}

/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