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

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

		long count = 0;
		int itr = 0;
		int n = Integer.parseInt(sc.next());

		String[] line = new String[n];
		char[][] word = new char[n][10];

		for (int i = 0; i < n; i++) {
			word[i] = sc.next().toCharArray();
			Arrays.sort(word[i]);
		}

		for (int i = 0; i < n; i++) {
			line[i] = String.valueOf(word[i]);
		}

		Arrays.sort(line);

		int ren = 1;
		for (int i = 1; i < n; i++) {
			if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			}
		}
		System.out.println(count);

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

		long count = 0;
		int itr = 0;
		int n = Integer.parseInt(sc.next());

		String[] line = new String[n];
		char[][] word = new char[n][10];

		for (int i = 0; i < n; i++) {
			word[i] = sc.next().toCharArray();
			Arrays.sort(word[i]);
		}

		for (int i = 0; i < n; i++) {
			line[i] = String.valueOf(word[i]);
		}

		Arrays.sort(line);

		int ren = 1;
		for (int i = 1; i < n; i++) {
			if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			}
		}
		System.out.println(count);

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

		long count = 0;
		int itr = 0;
		int n = Integer.parseInt(sc.next());

		String[] line = new String[n];
		char[][] word = new char[n][10];

		for (int i = 0; i < n; i++) {
			word[i] = sc.next().toCharArray();
			Arrays.sort(word[i]);
		}

		for (int i = 0; i < n; i++) {
			line[i] = String.valueOf(word[i]);
		}

		Arrays.sort(line);

		int ren = 1;
		for (int i = 1; i < n; i++) {
			if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			}
		}
		System.out.println(count);

	} main {
		Scanner sc = new Scanner(System.in);

		long count = 0;
		int itr = 0;
		int n = Integer.parseInt(sc.next());

		String[] line = new String[n];
		char[][] word = new char[n][10];

		for (int i = 0; i < n; i++) {
			word[i] = sc.next().toCharArray();
			Arrays.sort(word[i]);
		}

		for (int i = 0; i < n; i++) {
			line[i] = String.valueOf(word[i]);
		}

		Arrays.sort(line);

		int ren = 1;
		for (int i = 1; i < n; i++) {
			if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			}
		}
		System.out.println(count);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long count = 0; count 0 int itr = 0; itr 0 int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc String[] line = new String[n]; line new String[n] n char[][] word = new char[n][10]; word new char[n][10] n 10 for (int i = 0; i < n; i++) {
			word[i] = sc.next().toCharArray();
			Arrays.sort(word[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			word[i] = sc.next().toCharArray();
			Arrays.sort(word[i]);
		} {
			word[i] = sc.next().toCharArray();
			Arrays.sort(word[i]);
		} word[i] = sc.next().toCharArray() word[i] word i sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(word[i]) Arrays.sort Arrays word[i] word i for (int i = 0; i < n; i++) {
			line[i] = String.valueOf(word[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			line[i] = String.valueOf(word[i]);
		} {
			line[i] = String.valueOf(word[i]);
		} line[i] = String.valueOf(word[i]) line[i] line i String.valueOf(word[i]) String.valueOf String word[i] word i Arrays.sort(line) Arrays.sort Arrays line int ren = 1; ren 1 for (int i = 1; i < n; i++) {
			if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			}
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			}
		} {
			if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			}
		} if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			} line[itr].equals(line[i]) line[itr].equals line[itr] line itr line[i] line i {
				count+=ren;
				ren++;
			} count+=ren count ren ren++ ren {
				itr = i;
				ren=1;
			} itr = i itr i ren=1 ren 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long count = 0;
		int itr = 0;
		int n = Integer.parseInt(sc.next());

		String[] line = new String[n];
		char[][] word = new char[n][10];

		for (int i = 0; i < n; i++) {
			word[i] = sc.next().toCharArray();
			Arrays.sort(word[i]);
		}

		for (int i = 0; i < n; i++) {
			line[i] = String.valueOf(word[i]);
		}

		Arrays.sort(line);

		int ren = 1;
		for (int i = 1; i < n; i++) {
			if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			}
		}
		System.out.println(count);

	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long count = 0;
		int itr = 0;
		int n = Integer.parseInt(sc.next());

		String[] line = new String[n];
		char[][] word = new char[n][10];

		for (int i = 0; i < n; i++) {
			word[i] = sc.next().toCharArray();
			Arrays.sort(word[i]);
		}

		for (int i = 0; i < n; i++) {
			line[i] = String.valueOf(word[i]);
		}

		Arrays.sort(line);

		int ren = 1;
		for (int i = 1; i < n; i++) {
			if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			}
		}
		System.out.println(count);

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

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

		long count = 0;
		int itr = 0;
		int n = Integer.parseInt(sc.next());

		String[] line = new String[n];
		char[][] word = new char[n][10];

		for (int i = 0; i < n; i++) {
			word[i] = sc.next().toCharArray();
			Arrays.sort(word[i]);
		}

		for (int i = 0; i < n; i++) {
			line[i] = String.valueOf(word[i]);
		}

		Arrays.sort(line);

		int ren = 1;
		for (int i = 1; i < n; i++) {
			if(line[itr].equals(line[i])) {
				count+=ren;
				ren++;
			} else {
				itr = i;
				ren=1;
			}
		}
		System.out.println(count);

	}
}