import java.util.Arrays;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long a = s.nextInt();
		s.nextLine();
		Hashtable<String, Long> map = new Hashtable<>();
		long count = 0;
		for (int i = 0; i < a; i++) {
			String string = sort(s.nextLine());
			if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			}
		}
		System.out.println(count);

	}
	public static String sort(String x) {
		char[] sar =x.toCharArray();
		Arrays.sort(sar);
		return new String(sar);
	}

} import java.util.Arrays; Arrays java.util import java.util.HashSet; HashSet java.util import java.util.Hashtable; Hashtable java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long a = s.nextInt();
		s.nextLine();
		Hashtable<String, Long> map = new Hashtable<>();
		long count = 0;
		for (int i = 0; i < a; i++) {
			String string = sort(s.nextLine());
			if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			}
		}
		System.out.println(count);

	}
	public static String sort(String x) {
		char[] sar =x.toCharArray();
		Arrays.sort(sar);
		return new String(sar);
	}

} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long a = s.nextInt();
		s.nextLine();
		Hashtable<String, Long> map = new Hashtable<>();
		long count = 0;
		for (int i = 0; i < a; i++) {
			String string = sort(s.nextLine());
			if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			}
		}
		System.out.println(count);

	} main {
		Scanner s = new Scanner(System.in);
		long a = s.nextInt();
		s.nextLine();
		Hashtable<String, Long> map = new Hashtable<>();
		long count = 0;
		for (int i = 0; i < a; i++) {
			String string = sort(s.nextLine());
			if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			}
		}
		System.out.println(count);

	} Scanner s = new Scanner(System.in); s new Scanner(System.in) long a = s.nextInt(); a s.nextInt() s.nextInt s s.nextLine() s.nextLine s Hashtable<String, Long> map = new Hashtable<>(); map new Hashtable<>() long count = 0; count 0 for (int i = 0; i < a; i++) {
			String string = sort(s.nextLine());
			if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			}
		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
			String string = sort(s.nextLine());
			if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			}
		} {
			String string = sort(s.nextLine());
			if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			}
		} String string = sort(s.nextLine()); string sort(s.nextLine()) sort s.nextLine() s.nextLine s if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			} !map.containsKey(string) map.containsKey(string) map.containsKey map string {
				map.put(string, 1L);
			} map.put(string, 1L) map.put map string 1L {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			} count+=map.get(string) count map.get(string) map.get map string map.put(string, map.get(string)+1) map.put map string map.get(string)+1 map.get(string) map.get map string 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public static String sort(String x) {
		char[] sar =x.toCharArray();
		Arrays.sort(sar);
		return new String(sar);
	} sort {
		char[] sar =x.toCharArray();
		Arrays.sort(sar);
		return new String(sar);
	} char[] sar =x.toCharArray(); sar x.toCharArray() x.toCharArray x Arrays.sort(sar) Arrays.sort Arrays sar return new String(sar); new String(sar) String x x public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long a = s.nextInt();
		s.nextLine();
		Hashtable<String, Long> map = new Hashtable<>();
		long count = 0;
		for (int i = 0; i < a; i++) {
			String string = sort(s.nextLine());
			if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			}
		}
		System.out.println(count);

	}
	public static String sort(String x) {
		char[] sar =x.toCharArray();
		Arrays.sort(sar);
		return new String(sar);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long a = s.nextInt();
		s.nextLine();
		Hashtable<String, Long> map = new Hashtable<>();
		long count = 0;
		for (int i = 0; i < a; i++) {
			String string = sort(s.nextLine());
			if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			}
		}
		System.out.println(count);

	}
	public static String sort(String x) {
		char[] sar =x.toCharArray();
		Arrays.sort(sar);
		return new String(sar);
	}

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

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long a = s.nextInt();
		s.nextLine();
		Hashtable<String, Long> map = new Hashtable<>();
		long count = 0;
		for (int i = 0; i < a; i++) {
			String string = sort(s.nextLine());
			if(!map.containsKey(string)) {
				map.put(string, 1L);
			}else {
				count+=map.get(string);
				map.put(string, map.get(string)+1);
			}
		}
		System.out.println(count);

	}
	public static String sort(String x) {
		char[] sar =x.toCharArray();
		Arrays.sort(sar);
		return new String(sar);
	}

}
