import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long N = Integer.parseInt(sc.next());
		
		HashMap<String, Integer> map = new HashMap<>();
		long count = 0;
		for (int i = 0; i < N; i++) {
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			String s = new String(c);
			Integer n;
			if (map.containsKey(s)) {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			}	
			else {
				map.put(s, 0);
			}	
		}
		
		System.out.println(count);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long N = Integer.parseInt(sc.next());
		
		HashMap<String, Integer> map = new HashMap<>();
		long count = 0;
		for (int i = 0; i < N; i++) {
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			String s = new String(c);
			Integer n;
			if (map.containsKey(s)) {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			}	
			else {
				map.put(s, 0);
			}	
		}
		
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long N = Integer.parseInt(sc.next());
		
		HashMap<String, Integer> map = new HashMap<>();
		long count = 0;
		for (int i = 0; i < N; i++) {
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			String s = new String(c);
			Integer n;
			if (map.containsKey(s)) {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			}	
			else {
				map.put(s, 0);
			}	
		}
		
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		
		long N = Integer.parseInt(sc.next());
		
		HashMap<String, Integer> map = new HashMap<>();
		long count = 0;
		for (int i = 0; i < N; i++) {
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			String s = new String(c);
			Integer n;
			if (map.containsKey(s)) {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			}	
			else {
				map.put(s, 0);
			}	
		}
		
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc HashMap<String, Integer> map = new HashMap<>(); map new HashMap<>() long count = 0; count 0 for (int i = 0; i < N; i++) {
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			String s = new String(c);
			Integer n;
			if (map.containsKey(s)) {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			}	
			else {
				map.put(s, 0);
			}	
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			String s = new String(c);
			Integer n;
			if (map.containsKey(s)) {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			}	
			else {
				map.put(s, 0);
			}	
		} {
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			String s = new String(c);
			Integer n;
			if (map.containsKey(s)) {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			}	
			else {
				map.put(s, 0);
			}	
		} char[] c = sc.next().toCharArray(); c sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(c) Arrays.sort Arrays c String s = new String(c); s new String(c) Integer n; n if (map.containsKey(s)) {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			}	
			else {
				map.put(s, 0);
			} map.containsKey(s) map.containsKey map s {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			} n = map.get(s) n map.get(s) map.get map s map.put(s, n+1) map.put map s n+1 n 1 count += n+1 count n+1 n 1 {
				map.put(s, 0);
			} map.put(s, 0) map.put map s 0 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long N = Integer.parseInt(sc.next());
		
		HashMap<String, Integer> map = new HashMap<>();
		long count = 0;
		for (int i = 0; i < N; i++) {
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			String s = new String(c);
			Integer n;
			if (map.containsKey(s)) {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			}	
			else {
				map.put(s, 0);
			}	
		}
		
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long N = Integer.parseInt(sc.next());
		
		HashMap<String, Integer> map = new HashMap<>();
		long count = 0;
		for (int i = 0; i < N; i++) {
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			String s = new String(c);
			Integer n;
			if (map.containsKey(s)) {
				n = map.get(s);
				map.put(s, n+1);
				count += n+1;
			}	
			else {
				map.put(s, 0);
			}	
		}
		
		System.out.println(count);
	}
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

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