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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[]save = new String[N];
		long sum = 0;
		HashMap<String, Integer> countView = new HashMap<String, Integer>();
		for(int i = 0; i < N; i++) {
			String tmp = sc.next();
			char tmpArray[] = tmp.toCharArray();
			Arrays.sort(tmpArray);
			String afterSort = new String(tmpArray);
			//HashMapを使う
			if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			}
		}
		System.out.println(sum);
	}

} import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap 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[]save = new String[N];
		long sum = 0;
		HashMap<String, Integer> countView = new HashMap<String, Integer>();
		for(int i = 0; i < N; i++) {
			String tmp = sc.next();
			char tmpArray[] = tmp.toCharArray();
			Arrays.sort(tmpArray);
			String afterSort = new String(tmpArray);
			//HashMapを使う
			if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			}
		}
		System.out.println(sum);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[]save = new String[N];
		long sum = 0;
		HashMap<String, Integer> countView = new HashMap<String, Integer>();
		for(int i = 0; i < N; i++) {
			String tmp = sc.next();
			char tmpArray[] = tmp.toCharArray();
			Arrays.sort(tmpArray);
			String afterSort = new String(tmpArray);
			//HashMapを使う
			if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			}
		}
		System.out.println(sum);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[]save = new String[N];
		long sum = 0;
		HashMap<String, Integer> countView = new HashMap<String, Integer>();
		for(int i = 0; i < N; i++) {
			String tmp = sc.next();
			char tmpArray[] = tmp.toCharArray();
			Arrays.sort(tmpArray);
			String afterSort = new String(tmpArray);
			//HashMapを使う
			if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			}
		}
		System.out.println(sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc String[]save = new String[N]; save new String[N] N long sum = 0; sum 0 HashMap<String, Integer> countView = new HashMap<String, Integer>(); countView new HashMap<String, Integer>() for(int i = 0; i < N; i++) {
			String tmp = sc.next();
			char tmpArray[] = tmp.toCharArray();
			Arrays.sort(tmpArray);
			String afterSort = new String(tmpArray);
			//HashMapを使う
			if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			String tmp = sc.next();
			char tmpArray[] = tmp.toCharArray();
			Arrays.sort(tmpArray);
			String afterSort = new String(tmpArray);
			//HashMapを使う
			if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			}
		} {
			String tmp = sc.next();
			char tmpArray[] = tmp.toCharArray();
			Arrays.sort(tmpArray);
			String afterSort = new String(tmpArray);
			//HashMapを使う
			if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			}
		} String tmp = sc.next(); tmp sc.next() sc.next sc char tmpArray[] = tmp.toCharArray(); tmpArray tmp.toCharArray() tmp.toCharArray tmp Arrays.sort(tmpArray) Arrays.sort Arrays tmpArray String afterSort = new String(tmpArray); afterSort new String(tmpArray) if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			} countView.containsKey(afterSort) countView.containsKey countView afterSort {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			} int oldValue = countView.get(afterSort); oldValue countView.get(afterSort) countView.get countView afterSort int newValue = oldValue + 1; newValue oldValue + 1 oldValue 1 countView.put(afterSort, newValue) countView.put countView afterSort newValue sum += newValue sum newValue {
				countView.put(afterSort, 0);
			} countView.put(afterSort, 0) countView.put countView afterSort 0 System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[]save = new String[N];
		long sum = 0;
		HashMap<String, Integer> countView = new HashMap<String, Integer>();
		for(int i = 0; i < N; i++) {
			String tmp = sc.next();
			char tmpArray[] = tmp.toCharArray();
			Arrays.sort(tmpArray);
			String afterSort = new String(tmpArray);
			//HashMapを使う
			if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			}
		}
		System.out.println(sum);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[]save = new String[N];
		long sum = 0;
		HashMap<String, Integer> countView = new HashMap<String, Integer>();
		for(int i = 0; i < N; i++) {
			String tmp = sc.next();
			char tmpArray[] = tmp.toCharArray();
			Arrays.sort(tmpArray);
			String afterSort = new String(tmpArray);
			//HashMapを使う
			if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			}
		}
		System.out.println(sum);
	}

} Main
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[]save = new String[N];
		long sum = 0;
		HashMap<String, Integer> countView = new HashMap<String, Integer>();
		for(int i = 0; i < N; i++) {
			String tmp = sc.next();
			char tmpArray[] = tmp.toCharArray();
			Arrays.sort(tmpArray);
			String afterSort = new String(tmpArray);
			//HashMapを使う
			if(countView.containsKey(afterSort)) {
				int oldValue = countView.get(afterSort);
				int newValue = oldValue + 1;
				countView.put(afterSort, newValue);
				sum += newValue;
			}else {
				countView.put(afterSort, 0);
			}
		}
		System.out.println(sum);
	}

}