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

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Map<String, Long> map = new HashMap<>();
		long cnt = 0;
		for ( int i = 0; i < n; i++ ) {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			}
		}

		for ( Entry<String, Long> en : map.entrySet() ) {
			// System.out.println(en);
			cnt += en.getValue();
		}

		System.out.println(cnt);
		in.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.Map.Entry; Entry java.util.Map import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Map<String, Long> map = new HashMap<>();
		long cnt = 0;
		for ( int i = 0; i < n; i++ ) {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			}
		}

		for ( Entry<String, Long> en : map.entrySet() ) {
			// System.out.println(en);
			cnt += en.getValue();
		}

		System.out.println(cnt);
		in.close();
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Map<String, Long> map = new HashMap<>();
		long cnt = 0;
		for ( int i = 0; i < n; i++ ) {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			}
		}

		for ( Entry<String, Long> en : map.entrySet() ) {
			// System.out.println(en);
			cnt += en.getValue();
		}

		System.out.println(cnt);
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Map<String, Long> map = new HashMap<>();
		long cnt = 0;
		for ( int i = 0; i < n; i++ ) {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			}
		}

		for ( Entry<String, Long> en : map.entrySet() ) {
			// System.out.println(en);
			cnt += en.getValue();
		}

		System.out.println(cnt);
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in Map<String, Long> map = new HashMap<>(); map new HashMap<>() long cnt = 0; cnt 0 for ( int i = 0; i < n; i++ ) {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			}
		} {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			}
		} char[] s = in.next().toCharArray(); s in.next().toCharArray() in.next().toCharArray in.next() in.next in Arrays.sort(s) Arrays.sort Arrays s String key = new String(s); key new String(s) if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			} map.containsKey(key) map.containsKey map key {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} Long prev = map.get(key); prev map.get(key) map.get map key Long d = (long) Math.sqrt(prev * 2.0) + 1; d (long) Math.sqrt(prev * 2.0) + 1 (long) Math.sqrt(prev * 2.0) Math.sqrt Math prev * 2.0 prev 2.0 1 map.put(key, prev + d) map.put map key prev + d prev d {
				map.put(key, (long) 0);
			} map.put(key, (long) 0) map.put map key (long) 0 for ( Entry<String, Long> en : map.entrySet() ) {
			// System.out.println(en);
			cnt += en.getValue();
		} Entry<String, Long> en map.entrySet() map.entrySet map {
			// System.out.println(en);
			cnt += en.getValue();
		} {
			// System.out.println(en);
			cnt += en.getValue();
		} cnt += en.getValue() cnt en.getValue() en.getValue en System.out.println(cnt) System.out.println System.out System System.out cnt in.close() in.close in String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Map<String, Long> map = new HashMap<>();
		long cnt = 0;
		for ( int i = 0; i < n; i++ ) {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			}
		}

		for ( Entry<String, Long> en : map.entrySet() ) {
			// System.out.println(en);
			cnt += en.getValue();
		}

		System.out.println(cnt);
		in.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Map<String, Long> map = new HashMap<>();
		long cnt = 0;
		for ( int i = 0; i < n; i++ ) {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			}
		}

		for ( Entry<String, Long> en : map.entrySet() ) {
			// System.out.println(en);
			cnt += en.getValue();
		}

		System.out.println(cnt);
		in.close();
	}
} Main
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Map<String, Long> map = new HashMap<>();
		long cnt = 0;
		for ( int i = 0; i < n; i++ ) {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if ( map.containsKey(key) ) {
				Long prev = map.get(key);
				Long d = (long) Math.sqrt(prev * 2.0) + 1;
				map.put(key, prev + d);
			} else {
				map.put(key, (long) 0);
			}
		}

		for ( Entry<String, Long> en : map.entrySet() ) {
			// System.out.println(en);
			cnt += en.getValue();
		}

		System.out.println(cnt);
		in.close();
	}
}