import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		int a;

		Scanner sc = new Scanner(System.in);

		a = sc.nextInt();

		String[] ArrayA = new String[a];
		HashMap<String, Integer> hm = new HashMap<>();

		for(int i = 0; i < ArrayA.length; i++) {
			String b = sc.next();
			char[] c = b.toCharArray();
			Arrays.sort(c);
			hm.put(String.valueOf(c), hm.getOrDefault(String.valueOf(c), 0) + 1);
		}

		long ans = 0;
		for (String s : hm.keySet()) {
			ans += nc2(hm.get(s));
		}

		System.out.println(ans);
	}

	private static long nc2(long x) {
		return (x * (x - 1)) / 2;
	}


}

/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