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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		String line = scanner.nextLine();
		int N = Integer.parseInt(line);
		HashMap<String, Integer> hashmap = new HashMap<String, Integer>();

		long answer = 0;

		for (int i = 0; i < N; i++) {
			String[] readlines = scanner.nextLine().split("");
			Arrays.sort(readlines);

			String lines = "";
			for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j];

			if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			}
		}

		System.out.println(answer);
	}
} import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		String line = scanner.nextLine();
		int N = Integer.parseInt(line);
		HashMap<String, Integer> hashmap = new HashMap<String, Integer>();

		long answer = 0;

		for (int i = 0; i < N; i++) {
			String[] readlines = scanner.nextLine().split("");
			Arrays.sort(readlines);

			String lines = "";
			for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j];

			if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			}
		}

		System.out.println(answer);
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		String line = scanner.nextLine();
		int N = Integer.parseInt(line);
		HashMap<String, Integer> hashmap = new HashMap<String, Integer>();

		long answer = 0;

		for (int i = 0; i < N; i++) {
			String[] readlines = scanner.nextLine().split("");
			Arrays.sort(readlines);

			String lines = "";
			for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j];

			if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			}
		}

		System.out.println(answer);
	} main {
		Scanner scanner = new Scanner(System.in);

		String line = scanner.nextLine();
		int N = Integer.parseInt(line);
		HashMap<String, Integer> hashmap = new HashMap<String, Integer>();

		long answer = 0;

		for (int i = 0; i < N; i++) {
			String[] readlines = scanner.nextLine().split("");
			Arrays.sort(readlines);

			String lines = "";
			for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j];

			if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			}
		}

		System.out.println(answer);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String line = scanner.nextLine(); line scanner.nextLine() scanner.nextLine scanner int N = Integer.parseInt(line); N Integer.parseInt(line) Integer.parseInt Integer line HashMap<String, Integer> hashmap = new HashMap<String, Integer>(); hashmap new HashMap<String, Integer>() long answer = 0; answer 0 for (int i = 0; i < N; i++) {
			String[] readlines = scanner.nextLine().split("");
			Arrays.sort(readlines);

			String lines = "";
			for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j];

			if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			String[] readlines = scanner.nextLine().split("");
			Arrays.sort(readlines);

			String lines = "";
			for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j];

			if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			}
		} {
			String[] readlines = scanner.nextLine().split("");
			Arrays.sort(readlines);

			String lines = "";
			for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j];

			if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			}
		} String[] readlines = scanner.nextLine().split(""); readlines scanner.nextLine().split("") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner "" Arrays.sort(readlines) Arrays.sort Arrays readlines String lines = ""; lines "" for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j]; int j = 0; int j = 0; j 0 j < readlines.length j readlines.length readlines readlines.length j++ j++ j lines = lines + readlines[j]; lines = lines + readlines[j] lines lines + readlines[j] lines readlines[j] readlines j if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			} hashmap.containsKey(lines) hashmap.containsKey hashmap lines {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} answer = answer + hashmap.get(lines) answer answer + hashmap.get(lines) answer hashmap.get(lines) hashmap.get hashmap lines hashmap.replace(lines, hashmap.get(lines) + 1) hashmap.replace hashmap lines hashmap.get(lines) + 1 hashmap.get(lines) hashmap.get hashmap lines 1 {
				hashmap.put(lines, 1);
			} hashmap.put(lines, 1) hashmap.put hashmap lines 1 System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		String line = scanner.nextLine();
		int N = Integer.parseInt(line);
		HashMap<String, Integer> hashmap = new HashMap<String, Integer>();

		long answer = 0;

		for (int i = 0; i < N; i++) {
			String[] readlines = scanner.nextLine().split("");
			Arrays.sort(readlines);

			String lines = "";
			for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j];

			if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			}
		}

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

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		String line = scanner.nextLine();
		int N = Integer.parseInt(line);
		HashMap<String, Integer> hashmap = new HashMap<String, Integer>();

		long answer = 0;

		for (int i = 0; i < N; i++) {
			String[] readlines = scanner.nextLine().split("");
			Arrays.sort(readlines);

			String lines = "";
			for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j];

			if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			}
		}

		System.out.println(answer);
	}
} Main
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		String line = scanner.nextLine();
		int N = Integer.parseInt(line);
		HashMap<String, Integer> hashmap = new HashMap<String, Integer>();

		long answer = 0;

		for (int i = 0; i < N; i++) {
			String[] readlines = scanner.nextLine().split("");
			Arrays.sort(readlines);

			String lines = "";
			for (int j = 0; j < readlines.length; j++)
				lines = lines + readlines[j];

			if (hashmap.containsKey(lines)) {
				answer = answer + hashmap.get(lines);
				hashmap.replace(lines, hashmap.get(lines) + 1);
			} else {
				hashmap.put(lines, 1);
			}
		}

		System.out.println(answer);
	}
}
