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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
long ans=0;
		String con;
		String s[] = new String[n];
		for (int i = 0; i < n; i++) {
			con = sc.next();
			char[] c = con.toCharArray();
			Arrays.sort(c);
			s[i] = String.valueOf(c);
		}

		Arrays.sort(s);
		int how = 1;
		for (int i = 0; i < s.length - 1; i++) {
			if (!s[i].equals(s[i + 1])) {
				how++;
			}
		}
		int x[] = new int[how];
		Renzoku(s, x);

		for (int i = 0; i < how; i++) {
			ans+=con(x[i],2);
		}
		System.out.println(ans);
	}

	public static int Renzoku(String c[], int x[]) {

		int mode = 0;
		int val = 0;

		for (int i = 0; i <= c.length - 2; i++) {
			if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			}

		}
		return mode;

	}

	static public long con(int n, long r) {
		long num = 1;
		for (long i = 1; i <= r; i++) {
			num = num * (n - i + 1) / i;
		}
		return num;
	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
long ans=0;
		String con;
		String s[] = new String[n];
		for (int i = 0; i < n; i++) {
			con = sc.next();
			char[] c = con.toCharArray();
			Arrays.sort(c);
			s[i] = String.valueOf(c);
		}

		Arrays.sort(s);
		int how = 1;
		for (int i = 0; i < s.length - 1; i++) {
			if (!s[i].equals(s[i + 1])) {
				how++;
			}
		}
		int x[] = new int[how];
		Renzoku(s, x);

		for (int i = 0; i < how; i++) {
			ans+=con(x[i],2);
		}
		System.out.println(ans);
	}

	public static int Renzoku(String c[], int x[]) {

		int mode = 0;
		int val = 0;

		for (int i = 0; i <= c.length - 2; i++) {
			if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			}

		}
		return mode;

	}

	static public long con(int n, long r) {
		long num = 1;
		for (long i = 1; i <= r; i++) {
			num = num * (n - i + 1) / i;
		}
		return num;
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
long ans=0;
		String con;
		String s[] = new String[n];
		for (int i = 0; i < n; i++) {
			con = sc.next();
			char[] c = con.toCharArray();
			Arrays.sort(c);
			s[i] = String.valueOf(c);
		}

		Arrays.sort(s);
		int how = 1;
		for (int i = 0; i < s.length - 1; i++) {
			if (!s[i].equals(s[i + 1])) {
				how++;
			}
		}
		int x[] = new int[how];
		Renzoku(s, x);

		for (int i = 0; i < how; i++) {
			ans+=con(x[i],2);
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
long ans=0;
		String con;
		String s[] = new String[n];
		for (int i = 0; i < n; i++) {
			con = sc.next();
			char[] c = con.toCharArray();
			Arrays.sort(c);
			s[i] = String.valueOf(c);
		}

		Arrays.sort(s);
		int how = 1;
		for (int i = 0; i < s.length - 1; i++) {
			if (!s[i].equals(s[i + 1])) {
				how++;
			}
		}
		int x[] = new int[how];
		Renzoku(s, x);

		for (int i = 0; i < how; i++) {
			ans+=con(x[i],2);
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long ans=0; ans 0 String con; con String s[] = new String[n]; s new String[n] n for (int i = 0; i < n; i++) {
			con = sc.next();
			char[] c = con.toCharArray();
			Arrays.sort(c);
			s[i] = String.valueOf(c);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			con = sc.next();
			char[] c = con.toCharArray();
			Arrays.sort(c);
			s[i] = String.valueOf(c);
		} {
			con = sc.next();
			char[] c = con.toCharArray();
			Arrays.sort(c);
			s[i] = String.valueOf(c);
		} con = sc.next() con sc.next() sc.next sc char[] c = con.toCharArray(); c con.toCharArray() con.toCharArray con Arrays.sort(c) Arrays.sort Arrays c s[i] = String.valueOf(c) s[i] s i String.valueOf(c) String.valueOf String c Arrays.sort(s) Arrays.sort Arrays s int how = 1; how 1 for (int i = 0; i < s.length - 1; i++) {
			if (!s[i].equals(s[i + 1])) {
				how++;
			}
		} int i = 0; int i = 0; i 0 i < s.length - 1 i s.length - 1 s.length s s.length 1 i++ i++ i {
			if (!s[i].equals(s[i + 1])) {
				how++;
			}
		} {
			if (!s[i].equals(s[i + 1])) {
				how++;
			}
		} if (!s[i].equals(s[i + 1])) {
				how++;
			} !s[i].equals(s[i + 1]) s[i].equals(s[i + 1]) s[i].equals s[i] s i s[i + 1] s i + 1 i 1 {
				how++;
			} how++ how int x[] = new int[how]; x new int[how] how Renzoku(s, x) Renzoku s x for (int i = 0; i < how; i++) {
			ans+=con(x[i],2);
		} int i = 0; int i = 0; i 0 i < how i how i++ i++ i {
			ans+=con(x[i],2);
		} {
			ans+=con(x[i],2);
		} ans+=con(x[i],2) ans con(x[i],2) con x[i] x i 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static int Renzoku(String c[], int x[]) {

		int mode = 0;
		int val = 0;

		for (int i = 0; i <= c.length - 2; i++) {
			if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			}

		}
		return mode;

	} Renzoku {

		int mode = 0;
		int val = 0;

		for (int i = 0; i <= c.length - 2; i++) {
			if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			}

		}
		return mode;

	} int mode = 0; mode 0 int val = 0; val 0 for (int i = 0; i <= c.length - 2; i++) {
			if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			}

		} int i = 0; int i = 0; i 0 i <= c.length - 2 i c.length - 2 c.length c c.length 2 i++ i++ i {
			if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			}

		} {
			if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			}

		} if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			} (c[i].equals(c[i + 1])) && i != c.length - 2 (c[i].equals(c[i + 1])) c[i].equals c[i] c i c[i + 1] c i + 1 i 1 i != c.length - 2 i c.length - 2 c.length c c.length 2 {
				val++;
			} val++ val {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			} if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				} (c[i].equals(c[i + 1])) && i == c.length - 2 (c[i].equals(c[i + 1])) c[i].equals c[i] c i c[i + 1] c i + 1 i 1 i == c.length - 2 i c.length - 2 c.length c c.length 2 {
					val++;
				} val++ val val++ val x[mode] = val x[mode] x mode val mode++ mode if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				} !(c[i].equals(c[i + 1])) && i == c.length - 2 !(c[i].equals(c[i + 1])) (c[i].equals(c[i + 1])) c[i].equals c[i] c i c[i + 1] c i + 1 i 1 i == c.length - 2 i c.length - 2 c.length c c.length 2 {
					x[mode] = 1;
					mode++;
				} x[mode] = 1 x[mode] x mode 1 mode++ mode val = 0 val 0 return mode; mode String c[] c int x[] x static public long con(int n, long r) {
		long num = 1;
		for (long i = 1; i <= r; i++) {
			num = num * (n - i + 1) / i;
		}
		return num;
	} con {
		long num = 1;
		for (long i = 1; i <= r; i++) {
			num = num * (n - i + 1) / i;
		}
		return num;
	} long num = 1; num 1 for (long i = 1; i <= r; i++) {
			num = num * (n - i + 1) / i;
		} long i = 1; long i = 1; i 1 i <= r i r i++ i++ i {
			num = num * (n - i + 1) / i;
		} {
			num = num * (n - i + 1) / i;
		} num = num * (n - i + 1) / i num num * (n - i + 1) / i num * (n - i + 1) num (n - i + 1) n - i n i 1 i return num; num int n n long r r public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
long ans=0;
		String con;
		String s[] = new String[n];
		for (int i = 0; i < n; i++) {
			con = sc.next();
			char[] c = con.toCharArray();
			Arrays.sort(c);
			s[i] = String.valueOf(c);
		}

		Arrays.sort(s);
		int how = 1;
		for (int i = 0; i < s.length - 1; i++) {
			if (!s[i].equals(s[i + 1])) {
				how++;
			}
		}
		int x[] = new int[how];
		Renzoku(s, x);

		for (int i = 0; i < how; i++) {
			ans+=con(x[i],2);
		}
		System.out.println(ans);
	}

	public static int Renzoku(String c[], int x[]) {

		int mode = 0;
		int val = 0;

		for (int i = 0; i <= c.length - 2; i++) {
			if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			}

		}
		return mode;

	}

	static public long con(int n, long r) {
		long num = 1;
		for (long i = 1; i <= r; i++) {
			num = num * (n - i + 1) / i;
		}
		return num;
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
long ans=0;
		String con;
		String s[] = new String[n];
		for (int i = 0; i < n; i++) {
			con = sc.next();
			char[] c = con.toCharArray();
			Arrays.sort(c);
			s[i] = String.valueOf(c);
		}

		Arrays.sort(s);
		int how = 1;
		for (int i = 0; i < s.length - 1; i++) {
			if (!s[i].equals(s[i + 1])) {
				how++;
			}
		}
		int x[] = new int[how];
		Renzoku(s, x);

		for (int i = 0; i < how; i++) {
			ans+=con(x[i],2);
		}
		System.out.println(ans);
	}

	public static int Renzoku(String c[], int x[]) {

		int mode = 0;
		int val = 0;

		for (int i = 0; i <= c.length - 2; i++) {
			if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			}

		}
		return mode;

	}

	static public long con(int n, long r) {
		long num = 1;
		for (long i = 1; i <= r; i++) {
			num = num * (n - i + 1) / i;
		}
		return num;
	}

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
long ans=0;
		String con;
		String s[] = new String[n];
		for (int i = 0; i < n; i++) {
			con = sc.next();
			char[] c = con.toCharArray();
			Arrays.sort(c);
			s[i] = String.valueOf(c);
		}

		Arrays.sort(s);
		int how = 1;
		for (int i = 0; i < s.length - 1; i++) {
			if (!s[i].equals(s[i + 1])) {
				how++;
			}
		}
		int x[] = new int[how];
		Renzoku(s, x);

		for (int i = 0; i < how; i++) {
			ans+=con(x[i],2);
		}
		System.out.println(ans);
	}

	public static int Renzoku(String c[], int x[]) {

		int mode = 0;
		int val = 0;

		for (int i = 0; i <= c.length - 2; i++) {
			if ((c[i].equals(c[i + 1])) && i != c.length - 2) {
				val++;
			} else {
				if ((c[i].equals(c[i + 1])) && i == c.length - 2) {
					val++;
				}
				val++;
				x[mode] = val;
				mode++;

				if (!(c[i].equals(c[i + 1])) && i == c.length - 2) {
					x[mode] = 1;
					mode++;
				}

				val = 0;
			}

		}
		return mode;

	}

	static public long con(int n, long r) {
		long num = 1;
		for (long i = 1; i <= r; i++) {
			num = num * (n - i + 1) / i;
		}
		return num;
	}

}