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) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s = new String[n];

		long total = 0l;

		Map<String, Integer> map = new HashMap<>();

		for (int i = 0; i < n; i++) {
			s[i] = sc.next();
			char[] chars = s[i].toCharArray();
			Arrays.sort(chars);
			s[i] = new String(chars);
			map.put(s[i], -1);
		}

		for (int i = 0; i < n; i++) {
			map.put(s[i], map.get(s[i]) + 1);
			total += map.get(s[i]);
		}

		System.out.println(total);
		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) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s = new String[n];

		long total = 0l;

		Map<String, Integer> map = new HashMap<>();

		for (int i = 0; i < n; i++) {
			s[i] = sc.next();
			char[] chars = s[i].toCharArray();
			Arrays.sort(chars);
			s[i] = new String(chars);
			map.put(s[i], -1);
		}

		for (int i = 0; i < n; i++) {
			map.put(s[i], map.get(s[i]) + 1);
			total += map.get(s[i]);
		}

		System.out.println(total);
		sc.close();

	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s = new String[n];

		long total = 0l;

		Map<String, Integer> map = new HashMap<>();

		for (int i = 0; i < n; i++) {
			s[i] = sc.next();
			char[] chars = s[i].toCharArray();
			Arrays.sort(chars);
			s[i] = new String(chars);
			map.put(s[i], -1);
		}

		for (int i = 0; i < n; i++) {
			map.put(s[i], map.get(s[i]) + 1);
			total += map.get(s[i]);
		}

		System.out.println(total);
		sc.close();

	} main {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s = new String[n];

		long total = 0l;

		Map<String, Integer> map = new HashMap<>();

		for (int i = 0; i < n; i++) {
			s[i] = sc.next();
			char[] chars = s[i].toCharArray();
			Arrays.sort(chars);
			s[i] = new String(chars);
			map.put(s[i], -1);
		}

		for (int i = 0; i < n; i++) {
			map.put(s[i], map.get(s[i]) + 1);
			total += map.get(s[i]);
		}

		System.out.println(total);
		sc.close();

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String[] s = new String[n]; s new String[n] n long total = 0l; total 0l Map<String, Integer> map = new HashMap<>(); map new HashMap<>() for (int i = 0; i < n; i++) {
			s[i] = sc.next();
			char[] chars = s[i].toCharArray();
			Arrays.sort(chars);
			s[i] = new String(chars);
			map.put(s[i], -1);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			s[i] = sc.next();
			char[] chars = s[i].toCharArray();
			Arrays.sort(chars);
			s[i] = new String(chars);
			map.put(s[i], -1);
		} {
			s[i] = sc.next();
			char[] chars = s[i].toCharArray();
			Arrays.sort(chars);
			s[i] = new String(chars);
			map.put(s[i], -1);
		} s[i] = sc.next() s[i] s i sc.next() sc.next sc char[] chars = s[i].toCharArray(); chars s[i].toCharArray() s[i].toCharArray s[i] s i Arrays.sort(chars) Arrays.sort Arrays chars s[i] = new String(chars) s[i] s i new String(chars) map.put(s[i], -1) map.put map s[i] s i -1 1 for (int i = 0; i < n; i++) {
			map.put(s[i], map.get(s[i]) + 1);
			total += map.get(s[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			map.put(s[i], map.get(s[i]) + 1);
			total += map.get(s[i]);
		} {
			map.put(s[i], map.get(s[i]) + 1);
			total += map.get(s[i]);
		} map.put(s[i], map.get(s[i]) + 1) map.put map s[i] s i map.get(s[i]) + 1 map.get(s[i]) map.get map s[i] s i 1 total += map.get(s[i]) total map.get(s[i]) map.get map s[i] s i System.out.println(total) System.out.println System.out System System.out total sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s = new String[n];

		long total = 0l;

		Map<String, Integer> map = new HashMap<>();

		for (int i = 0; i < n; i++) {
			s[i] = sc.next();
			char[] chars = s[i].toCharArray();
			Arrays.sort(chars);
			s[i] = new String(chars);
			map.put(s[i], -1);
		}

		for (int i = 0; i < n; i++) {
			map.put(s[i], map.get(s[i]) + 1);
			total += map.get(s[i]);
		}

		System.out.println(total);
		sc.close();

	}

} public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s = new String[n];

		long total = 0l;

		Map<String, Integer> map = new HashMap<>();

		for (int i = 0; i < n; i++) {
			s[i] = sc.next();
			char[] chars = s[i].toCharArray();
			Arrays.sort(chars);
			s[i] = new String(chars);
			map.put(s[i], -1);
		}

		for (int i = 0; i < n; i++) {
			map.put(s[i], map.get(s[i]) + 1);
			total += map.get(s[i]);
		}

		System.out.println(total);
		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) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s = new String[n];

		long total = 0l;

		Map<String, Integer> map = new HashMap<>();

		for (int i = 0; i < n; i++) {
			s[i] = sc.next();
			char[] chars = s[i].toCharArray();
			Arrays.sort(chars);
			s[i] = new String(chars);
			map.put(s[i], -1);
		}

		for (int i = 0; i < n; i++) {
			map.put(s[i], map.get(s[i]) + 1);
			total += map.get(s[i]);
		}

		System.out.println(total);
		sc.close();

	}

}