import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<String, Integer> s = new HashMap<>(N);
		long ans = 0;
		for (int i = 0; i < N; i++) {
			String input = sc.next();
			char[] c = input.toCharArray();
			Arrays.sort(c);
			String tmp = new String(c);
			if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<String, Integer> s = new HashMap<>(N);
		long ans = 0;
		for (int i = 0; i < N; i++) {
			String input = sc.next();
			char[] c = input.toCharArray();
			Arrays.sort(c);
			String tmp = new String(c);
			if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<String, Integer> s = new HashMap<>(N);
		long ans = 0;
		for (int i = 0; i < N; i++) {
			String input = sc.next();
			char[] c = input.toCharArray();
			Arrays.sort(c);
			String tmp = new String(c);
			if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			}
		}
		System.out.println(ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<String, Integer> s = new HashMap<>(N);
		long ans = 0;
		for (int i = 0; i < N; i++) {
			String input = sc.next();
			char[] c = input.toCharArray();
			Arrays.sort(c);
			String tmp = new String(c);
			if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			}
		}
		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc Map<String, Integer> s = new HashMap<>(N); s new HashMap<>(N) long ans = 0; ans 0 for (int i = 0; i < N; i++) {
			String input = sc.next();
			char[] c = input.toCharArray();
			Arrays.sort(c);
			String tmp = new String(c);
			if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			String input = sc.next();
			char[] c = input.toCharArray();
			Arrays.sort(c);
			String tmp = new String(c);
			if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			}
		} {
			String input = sc.next();
			char[] c = input.toCharArray();
			Arrays.sort(c);
			String tmp = new String(c);
			if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			}
		} String input = sc.next(); input sc.next() sc.next sc char[] c = input.toCharArray(); c input.toCharArray() input.toCharArray input Arrays.sort(c) Arrays.sort Arrays c String tmp = new String(c); tmp new String(c) if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			} s.containsKey(tmp) s.containsKey s tmp {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} int v = s.get(tmp) + 1; v s.get(tmp) + 1 s.get(tmp) s.get s tmp 1 ans += v ans v s.put(tmp, v) s.put s tmp v {
				s.put(tmp, 0);
			} s.put(tmp, 0) s.put s tmp 0 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<String, Integer> s = new HashMap<>(N);
		long ans = 0;
		for (int i = 0; i < N; i++) {
			String input = sc.next();
			char[] c = input.toCharArray();
			Arrays.sort(c);
			String tmp = new String(c);
			if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<String, Integer> s = new HashMap<>(N);
		long ans = 0;
		for (int i = 0; i < N; i++) {
			String input = sc.next();
			char[] c = input.toCharArray();
			Arrays.sort(c);
			String tmp = new String(c);
			if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			}
		}
		System.out.println(ans);
		sc.close();
	}
} Main
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<String, Integer> s = new HashMap<>(N);
		long ans = 0;
		for (int i = 0; i < N; i++) {
			String input = sc.next();
			char[] c = input.toCharArray();
			Arrays.sort(c);
			String tmp = new String(c);
			if (s.containsKey(tmp)) {
				int v = s.get(tmp) + 1;
				ans += v;
				s.put(tmp, v);
			} else {
				s.put(tmp, 0);
			}
		}
		System.out.println(ans);
		sc.close();
	}
}