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);
		String count = sc.next();
		long ans = 0;
		Map<String, Long> map = new HashMap<String, Long>();

		for (int i = 0; i < Integer.parseInt(count); i++) {
			char[] ary = sc.next().toCharArray();
			Arrays.sort(ary);
			String c = 	new String(ary);
				if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				}
			}

		System.out.println(ans);
	}

} 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);
		String count = sc.next();
		long ans = 0;
		Map<String, Long> map = new HashMap<String, Long>();

		for (int i = 0; i < Integer.parseInt(count); i++) {
			char[] ary = sc.next().toCharArray();
			Arrays.sort(ary);
			String c = 	new String(ary);
				if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				}
			}

		System.out.println(ans);
	}

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

		Scanner sc = new Scanner(System.in);
		String count = sc.next();
		long ans = 0;
		Map<String, Long> map = new HashMap<String, Long>();

		for (int i = 0; i < Integer.parseInt(count); i++) {
			char[] ary = sc.next().toCharArray();
			Arrays.sort(ary);
			String c = 	new String(ary);
				if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				}
			}

		System.out.println(ans);
	} main {

		Scanner sc = new Scanner(System.in);
		String count = sc.next();
		long ans = 0;
		Map<String, Long> map = new HashMap<String, Long>();

		for (int i = 0; i < Integer.parseInt(count); i++) {
			char[] ary = sc.next().toCharArray();
			Arrays.sort(ary);
			String c = 	new String(ary);
				if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				}
			}

		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String count = sc.next(); count sc.next() sc.next sc long ans = 0; ans 0 Map<String, Long> map = new HashMap<String, Long>(); map new HashMap<String, Long>() for (int i = 0; i < Integer.parseInt(count); i++) {
			char[] ary = sc.next().toCharArray();
			Arrays.sort(ary);
			String c = 	new String(ary);
				if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				}
			} int i = 0; int i = 0; i 0 i < Integer.parseInt(count) i Integer.parseInt(count) Integer.parseInt Integer count i++ i++ i {
			char[] ary = sc.next().toCharArray();
			Arrays.sort(ary);
			String c = 	new String(ary);
				if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				}
			} {
			char[] ary = sc.next().toCharArray();
			Arrays.sort(ary);
			String c = 	new String(ary);
				if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				}
			} char[] ary = sc.next().toCharArray(); ary sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(ary) Arrays.sort Arrays ary String c = 	new String(ary); c new String(ary) if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				} map.containsKey(c) map.containsKey map c {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} ans = ans + map.get(c) ans ans + map.get(c) ans map.get(c) map.get map c map.put(c, map.get(c) + 1) map.put map c map.get(c) + 1 map.get(c) map.get map c 1 {
					map.put(c, (long) 1);
				} map.put(c, (long) 1) map.put map c (long) 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String count = sc.next();
		long ans = 0;
		Map<String, Long> map = new HashMap<String, Long>();

		for (int i = 0; i < Integer.parseInt(count); i++) {
			char[] ary = sc.next().toCharArray();
			Arrays.sort(ary);
			String c = 	new String(ary);
				if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				}
			}

		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String count = sc.next();
		long ans = 0;
		Map<String, Long> map = new HashMap<String, Long>();

		for (int i = 0; i < Integer.parseInt(count); i++) {
			char[] ary = sc.next().toCharArray();
			Arrays.sort(ary);
			String c = 	new String(ary);
				if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				}
			}

		System.out.println(ans);
	}

} 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);
		String count = sc.next();
		long ans = 0;
		Map<String, Long> map = new HashMap<String, Long>();

		for (int i = 0; i < Integer.parseInt(count); i++) {
			char[] ary = sc.next().toCharArray();
			Arrays.sort(ary);
			String c = 	new String(ary);
				if (map.containsKey(c)) {
					ans = ans + map.get(c);
					map.put(c, map.get(c) + 1);
				} else {
					map.put(c, (long) 1);
				}
			}

		System.out.println(ans);
	}

}