import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String str[] = new String[n];
		HashMap<String, Long> map = new HashMap<>();

		long ans = 0;
		for (int i = 0; i < n; i++) {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}

			if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			}
		}

		System.out.println(ans);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String str[] = new String[n];
		HashMap<String, Long> map = new HashMap<>();

		long ans = 0;
		for (int i = 0; i < n; i++) {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}

			if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			}
		}

		System.out.println(ans);
	}
} Main public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String str[] = new String[n];
		HashMap<String, Long> map = new HashMap<>();

		long ans = 0;
		for (int i = 0; i < n; i++) {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}

			if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			}
		}

		System.out.println(ans);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String str[] = new String[n];
		HashMap<String, Long> map = new HashMap<>();

		long ans = 0;
		for (int i = 0; i < n; i++) {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}

			if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			}
		}

		System.out.println(ans);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String str[] = new String[n]; str new String[n] n HashMap<String, Long> map = new HashMap<>(); map new HashMap<>() long ans = 0; ans 0 for (int i = 0; i < n; i++) {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}

			if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}

			if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			}
		} {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}

			if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			}
		} String s[] = br.readLine().split(""); s br.readLine().split("") br.readLine().split br.readLine() br.readLine br "" Arrays.sort(s) Arrays.sort Arrays s str[i] = "" str[i] str i "" for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			} int j = 0; int j = 0; j 0 j < 10 j 10 j++ j++ j {
				str[i] += s[j];
			} {
				str[i] += s[j];
			} str[i] += s[j] str[i] str i s[j] s j if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			} map.containsKey(str[i]) map.containsKey map str[i] str i {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} long l = map.get(str[i]) + 1; l map.get(str[i]) + 1 map.get(str[i]) map.get map str[i] str i 1 ans += l ans l map.put(str[i], l) map.put map str[i] str i l {
				map.put(str[i], 0L);
			} map.put(str[i], 0L) map.put map str[i] str i 0L System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String str[] = new String[n];
		HashMap<String, Long> map = new HashMap<>();

		long ans = 0;
		for (int i = 0; i < n; i++) {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}

			if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			}
		}

		System.out.println(ans);
	}
} public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String str[] = new String[n];
		HashMap<String, Long> map = new HashMap<>();

		long ans = 0;
		for (int i = 0; i < n; i++) {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}

			if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			}
		}

		System.out.println(ans);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String str[] = new String[n];
		HashMap<String, Long> map = new HashMap<>();

		long ans = 0;
		for (int i = 0; i < n; i++) {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}

			if (map.containsKey(str[i])) {
				long l = map.get(str[i]) + 1;
				ans += l;
				map.put(str[i], l);
			} else {
				map.put(str[i], 0L);
			}
		}

		System.out.println(ans);
	}
}