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();
		sc.nextLine();
		String sort = "";
		String[] anagram = new String[N];
		long count = 0;
		//文字列一つずつ並び替え
		for(int i = 0; i<N ; i++) {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		}
		//HashMapに一つずつ判定して入れる。重複があればカウント。
		HashMap<String,Long> checklist = new HashMap<>();
		for(int i = 0; i<N; i++) {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		}
		System.out.println(count);
	}

} 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();
		sc.nextLine();
		String sort = "";
		String[] anagram = new String[N];
		long count = 0;
		//文字列一つずつ並び替え
		for(int i = 0; i<N ; i++) {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		}
		//HashMapに一つずつ判定して入れる。重複があればカウント。
		HashMap<String,Long> checklist = new HashMap<>();
		for(int i = 0; i<N; i++) {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		}
		System.out.println(count);
	}

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

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		sc.nextLine();
		String sort = "";
		String[] anagram = new String[N];
		long count = 0;
		//文字列一つずつ並び替え
		for(int i = 0; i<N ; i++) {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		}
		//HashMapに一つずつ判定して入れる。重複があればカウント。
		HashMap<String,Long> checklist = new HashMap<>();
		for(int i = 0; i<N; i++) {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		}
		System.out.println(count);
	} main {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		sc.nextLine();
		String sort = "";
		String[] anagram = new String[N];
		long count = 0;
		//文字列一つずつ並び替え
		for(int i = 0; i<N ; i++) {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		}
		//HashMapに一つずつ判定して入れる。重複があればカウント。
		HashMap<String,Long> checklist = new HashMap<>();
		for(int i = 0; i<N; i++) {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		}
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc String sort = ""; sort "" String[] anagram = new String[N]; anagram new String[N] N long count = 0; count 0 for(int i = 0; i<N ; i++) {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		} {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		} sort = sc.nextLine() sort sc.nextLine() sc.nextLine sc String[] change = sort.split(""); change sort.split("") sort.split sort "" Arrays.sort(change) Arrays.sort Arrays change anagram[i] = String.join("",change) anagram[i] anagram i String.join("",change) String.join String "" change HashMap<String,Long> checklist = new HashMap<>(); checklist new HashMap<>() for(int i = 0; i<N; i++) {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		} {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		} if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			} checklist.containsKey(anagram[i]) checklist.containsKey checklist anagram[i] anagram i {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			} long value = checklist.get(anagram[i]); value checklist.get(anagram[i]) checklist.get checklist anagram[i] anagram i count+=value count value checklist.put(anagram[i], value+1) checklist.put checklist anagram[i] anagram i value+1 value 1 {
				checklist.put(anagram[i],(long)1);
			} checklist.put(anagram[i],(long)1) checklist.put checklist anagram[i] anagram i (long)1 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);

		int N = sc.nextInt();
		sc.nextLine();
		String sort = "";
		String[] anagram = new String[N];
		long count = 0;
		//文字列一つずつ並び替え
		for(int i = 0; i<N ; i++) {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		}
		//HashMapに一つずつ判定して入れる。重複があればカウント。
		HashMap<String,Long> checklist = new HashMap<>();
		for(int i = 0; i<N; i++) {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		}
		System.out.println(count);
	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		sc.nextLine();
		String sort = "";
		String[] anagram = new String[N];
		long count = 0;
		//文字列一つずつ並び替え
		for(int i = 0; i<N ; i++) {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		}
		//HashMapに一つずつ判定して入れる。重複があればカウント。
		HashMap<String,Long> checklist = new HashMap<>();
		for(int i = 0; i<N; i++) {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		}
		System.out.println(count);
	}

} 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();
		sc.nextLine();
		String sort = "";
		String[] anagram = new String[N];
		long count = 0;
		//文字列一つずつ並び替え
		for(int i = 0; i<N ; i++) {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		}
		//HashMapに一つずつ判定して入れる。重複があればカウント。
		HashMap<String,Long> checklist = new HashMap<>();
		for(int i = 0; i<N; i++) {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		}
		System.out.println(count);
	}

}
