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

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];
		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];
			}
		}

		Arrays.sort(str);

		long ans = 0;
		int j = 1;

		for (int i = 0; i < n; i++) {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		}

		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 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];
		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];
			}
		}

		Arrays.sort(str);

		long ans = 0;
		int j = 1;

		for (int i = 0; i < n; i++) {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		}

		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];
		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];
			}
		}

		Arrays.sort(str);

		long ans = 0;
		int j = 1;

		for (int i = 0; i < n; i++) {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		}

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

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

		String str[] = new String[n];
		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];
			}
		}

		Arrays.sort(str);

		long ans = 0;
		int j = 1;

		for (int i = 0; i < n; i++) {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		}

		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 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];
			}
		} 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];
			}
		} {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}
		} 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 Arrays.sort(str) Arrays.sort Arrays str long ans = 0; ans 0 int j = 1; j 1 for (int i = 0; i < n; i++) {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		} {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		} if (i == j) {
				j++;
			} i == j i j {
				j++;
			} j++ j while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			} j < n && str[i].equals(str[j]) j < n j n str[i].equals(str[j]) str[i].equals str[i] str i str[j] str j {
				ans += j - i;
				j++;
			} ans += j - i ans j - i j i j++ j 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];
		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];
			}
		}

		Arrays.sort(str);

		long ans = 0;
		int j = 1;

		for (int i = 0; i < n; i++) {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		}

		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];
		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];
			}
		}

		Arrays.sort(str);

		long ans = 0;
		int j = 1;

		for (int i = 0; i < n; i++) {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		}

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

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];
		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];
			}
		}

		Arrays.sort(str);

		long ans = 0;
		int j = 1;

		for (int i = 0; i < n; i++) {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		}

		System.out.println(ans);
	}
}