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

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[] input = new String[N];
		for (int i = 0; i < input.length; i++) {
			String[] tmp = sc.next().split("");
			Arrays.sort(tmp);
			input[i] = String.join("", tmp);
		}
		Arrays.sort(input);
		long res = 0;
		int conn = 0;
		String before = "";
		for (String element : input) {
			if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			}
			before = element;
		}
		System.out.println(res);
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[] input = new String[N];
		for (int i = 0; i < input.length; i++) {
			String[] tmp = sc.next().split("");
			Arrays.sort(tmp);
			input[i] = String.join("", tmp);
		}
		Arrays.sort(input);
		long res = 0;
		int conn = 0;
		String before = "";
		for (String element : input) {
			if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			}
			before = element;
		}
		System.out.println(res);
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[] input = new String[N];
		for (int i = 0; i < input.length; i++) {
			String[] tmp = sc.next().split("");
			Arrays.sort(tmp);
			input[i] = String.join("", tmp);
		}
		Arrays.sort(input);
		long res = 0;
		int conn = 0;
		String before = "";
		for (String element : input) {
			if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			}
			before = element;
		}
		System.out.println(res);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[] input = new String[N];
		for (int i = 0; i < input.length; i++) {
			String[] tmp = sc.next().split("");
			Arrays.sort(tmp);
			input[i] = String.join("", tmp);
		}
		Arrays.sort(input);
		long res = 0;
		int conn = 0;
		String before = "";
		for (String element : input) {
			if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			}
			before = element;
		}
		System.out.println(res);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc String[] input = new String[N]; input new String[N] N for (int i = 0; i < input.length; i++) {
			String[] tmp = sc.next().split("");
			Arrays.sort(tmp);
			input[i] = String.join("", tmp);
		} int i = 0; int i = 0; i 0 i < input.length i input.length input input.length i++ i++ i {
			String[] tmp = sc.next().split("");
			Arrays.sort(tmp);
			input[i] = String.join("", tmp);
		} {
			String[] tmp = sc.next().split("");
			Arrays.sort(tmp);
			input[i] = String.join("", tmp);
		} String[] tmp = sc.next().split(""); tmp sc.next().split("") sc.next().split sc.next() sc.next sc "" Arrays.sort(tmp) Arrays.sort Arrays tmp input[i] = String.join("", tmp) input[i] input i String.join("", tmp) String.join String "" tmp Arrays.sort(input) Arrays.sort Arrays input long res = 0; res 0 int conn = 0; conn 0 String before = ""; before "" for (String element : input) {
			if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			}
			before = element;
		} String element input {
			if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			}
			before = element;
		} {
			if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			}
			before = element;
		} if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			} before.equals(element) before.equals before element {
				conn++;
				res += conn;
			} conn++ conn res += conn res conn {
				conn = 0;
			} conn = 0 conn 0 before = element before element System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[] input = new String[N];
		for (int i = 0; i < input.length; i++) {
			String[] tmp = sc.next().split("");
			Arrays.sort(tmp);
			input[i] = String.join("", tmp);
		}
		Arrays.sort(input);
		long res = 0;
		int conn = 0;
		String before = "";
		for (String element : input) {
			if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			}
			before = element;
		}
		System.out.println(res);
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[] input = new String[N];
		for (int i = 0; i < input.length; i++) {
			String[] tmp = sc.next().split("");
			Arrays.sort(tmp);
			input[i] = String.join("", tmp);
		}
		Arrays.sort(input);
		long res = 0;
		int conn = 0;
		String before = "";
		for (String element : input) {
			if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			}
			before = element;
		}
		System.out.println(res);
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[] input = new String[N];
		for (int i = 0; i < input.length; i++) {
			String[] tmp = sc.next().split("");
			Arrays.sort(tmp);
			input[i] = String.join("", tmp);
		}
		Arrays.sort(input);
		long res = 0;
		int conn = 0;
		String before = "";
		for (String element : input) {
			if (before.equals(element)) {
				conn++;
				res += conn;
			} else {
				conn = 0;
			}
			before = element;
		}
		System.out.println(res);
	}
}