import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		String[] s = new String[n];
		for (int i = 0; i < n; i++) {
			char[] t = in.next().toCharArray();
			Arrays.sort(t);
			s[i] = String.valueOf(t);
		}
		System.out.println(solve(n, s));
		in.close();
	}

	private static long solve(int n, String[] s) {
		long ans = 0;
		Arrays.sort(s);
		int p = 0;
		for (int i = 1; i < n; i++)
			if (!s[p].equals(s[i])) {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			}
		long l = n - p;
		if (l > 1)
			ans += l * (l - 1) / 2;
		return ans;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Scanner; Scanner java.util public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		String[] s = new String[n];
		for (int i = 0; i < n; i++) {
			char[] t = in.next().toCharArray();
			Arrays.sort(t);
			s[i] = String.valueOf(t);
		}
		System.out.println(solve(n, s));
		in.close();
	}

	private static long solve(int n, String[] s) {
		long ans = 0;
		Arrays.sort(s);
		int p = 0;
		for (int i = 1; i < n; i++)
			if (!s[p].equals(s[i])) {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			}
		long l = n - p;
		if (l > 1)
			ans += l * (l - 1) / 2;
		return ans;
	}
} Main private static final boolean TEST = true; TEST true public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		String[] s = new String[n];
		for (int i = 0; i < n; i++) {
			char[] t = in.next().toCharArray();
			Arrays.sort(t);
			s[i] = String.valueOf(t);
		}
		System.out.println(solve(n, s));
		in.close();
	} main {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		String[] s = new String[n];
		for (int i = 0; i < n; i++) {
			char[] t = in.next().toCharArray();
			Arrays.sort(t);
			s[i] = String.valueOf(t);
		}
		System.out.println(solve(n, s));
		in.close();
	} Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) int n = in.nextInt(); n in.nextInt() in.nextInt in String[] s = new String[n]; s new String[n] n for (int i = 0; i < n; i++) {
			char[] t = in.next().toCharArray();
			Arrays.sort(t);
			s[i] = String.valueOf(t);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			char[] t = in.next().toCharArray();
			Arrays.sort(t);
			s[i] = String.valueOf(t);
		} {
			char[] t = in.next().toCharArray();
			Arrays.sort(t);
			s[i] = String.valueOf(t);
		} char[] t = in.next().toCharArray(); t in.next().toCharArray() in.next().toCharArray in.next() in.next in Arrays.sort(t) Arrays.sort Arrays t s[i] = String.valueOf(t) s[i] s i String.valueOf(t) String.valueOf String t System.out.println(solve(n, s)) System.out.println System.out System System.out solve(n, s) solve n s in.close() in.close in String[] args args private static long solve(int n, String[] s) {
		long ans = 0;
		Arrays.sort(s);
		int p = 0;
		for (int i = 1; i < n; i++)
			if (!s[p].equals(s[i])) {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			}
		long l = n - p;
		if (l > 1)
			ans += l * (l - 1) / 2;
		return ans;
	} solve {
		long ans = 0;
		Arrays.sort(s);
		int p = 0;
		for (int i = 1; i < n; i++)
			if (!s[p].equals(s[i])) {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			}
		long l = n - p;
		if (l > 1)
			ans += l * (l - 1) / 2;
		return ans;
	} long ans = 0; ans 0 Arrays.sort(s) Arrays.sort Arrays s int p = 0; p 0 for (int i = 1; i < n; i++)
			if (!s[p].equals(s[i])) {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			} int i = 1; int i = 1; i 1 i < n i n i++ i++ i if (!s[p].equals(s[i])) {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			} if (!s[p].equals(s[i])) {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			} !s[p].equals(s[i]) s[p].equals(s[i]) s[p].equals s[p] s p s[i] s i {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			} long l = i - p; l i - p i p if (l > 1)
					ans += l * (l - 1) / 2; l > 1 l 1 ans += l * (l - 1) / 2 ans l * (l - 1) / 2 l * (l - 1) l (l - 1) l 1 2 p = i p i long l = n - p; l n - p n p if (l > 1)
			ans += l * (l - 1) / 2; l > 1 l 1 ans += l * (l - 1) / 2 ans l * (l - 1) / 2 l * (l - 1) l (l - 1) l 1 2 return ans; ans int n n String[] s s public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		String[] s = new String[n];
		for (int i = 0; i < n; i++) {
			char[] t = in.next().toCharArray();
			Arrays.sort(t);
			s[i] = String.valueOf(t);
		}
		System.out.println(solve(n, s));
		in.close();
	}

	private static long solve(int n, String[] s) {
		long ans = 0;
		Arrays.sort(s);
		int p = 0;
		for (int i = 1; i < n; i++)
			if (!s[p].equals(s[i])) {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			}
		long l = n - p;
		if (l > 1)
			ans += l * (l - 1) / 2;
		return ans;
	}
} public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		String[] s = new String[n];
		for (int i = 0; i < n; i++) {
			char[] t = in.next().toCharArray();
			Arrays.sort(t);
			s[i] = String.valueOf(t);
		}
		System.out.println(solve(n, s));
		in.close();
	}

	private static long solve(int n, String[] s) {
		long ans = 0;
		Arrays.sort(s);
		int p = 0;
		for (int i = 1; i < n; i++)
			if (!s[p].equals(s[i])) {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			}
		long l = n - p;
		if (l > 1)
			ans += l * (l - 1) / 2;
		return ans;
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		String[] s = new String[n];
		for (int i = 0; i < n; i++) {
			char[] t = in.next().toCharArray();
			Arrays.sort(t);
			s[i] = String.valueOf(t);
		}
		System.out.println(solve(n, s));
		in.close();
	}

	private static long solve(int n, String[] s) {
		long ans = 0;
		Arrays.sort(s);
		int p = 0;
		for (int i = 1; i < n; i++)
			if (!s[p].equals(s[i])) {
				long l = i - p;
				if (l > 1)
					ans += l * (l - 1) / 2;
				p = i;
			}
		long l = n - p;
		if (l > 1)
			ans += l * (l - 1) / 2;
		return ans;
	}
}
