import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		ArrayList<String> arr = new ArrayList<>();
		long count = 0;
		sc.nextLine();
		for(int i = 0;i<input;i++) {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		}
		Collections.sort(arr);
		long dif = 0;
		int curr = 0;
		for(int i = 1;i<arr.size();i++) {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		}
		dif = input-curr;
		count += dif*(dif-1)/2;
		System.out.println(count);
	}

} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collection; Collection java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.stream.Collectors; Collectors java.util.stream public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		ArrayList<String> arr = new ArrayList<>();
		long count = 0;
		sc.nextLine();
		for(int i = 0;i<input;i++) {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		}
		Collections.sort(arr);
		long dif = 0;
		int curr = 0;
		for(int i = 1;i<arr.size();i++) {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		}
		dif = input-curr;
		count += dif*(dif-1)/2;
		System.out.println(count);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		ArrayList<String> arr = new ArrayList<>();
		long count = 0;
		sc.nextLine();
		for(int i = 0;i<input;i++) {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		}
		Collections.sort(arr);
		long dif = 0;
		int curr = 0;
		for(int i = 1;i<arr.size();i++) {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		}
		dif = input-curr;
		count += dif*(dif-1)/2;
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		ArrayList<String> arr = new ArrayList<>();
		long count = 0;
		sc.nextLine();
		for(int i = 0;i<input;i++) {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		}
		Collections.sort(arr);
		long dif = 0;
		int curr = 0;
		for(int i = 1;i<arr.size();i++) {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		}
		dif = input-curr;
		count += dif*(dif-1)/2;
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int input = sc.nextInt(); input sc.nextInt() sc.nextInt sc ArrayList<String> arr = new ArrayList<>(); arr new ArrayList<>() long count = 0; count 0 sc.nextLine() sc.nextLine sc for(int i = 0;i<input;i++) {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		} int i = 0; int i = 0; i 0 i<input i input i++ i++ i {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		} {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		} char[] temp = sc.nextLine().toCharArray(); temp sc.nextLine().toCharArray() sc.nextLine().toCharArray sc.nextLine() sc.nextLine sc Arrays.sort(temp) Arrays.sort Arrays temp String out = new String(temp); out new String(temp) arr.add(out.toString()) arr.add arr out.toString() out.toString out Collections.sort(arr) Collections.sort Collections arr long dif = 0; dif 0 int curr = 0; curr 0 for(int i = 1;i<arr.size();i++) {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		} int i = 1; int i = 1; i 1 i<arr.size() i arr.size() arr.size arr i++ i++ i {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		} {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		} if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			} !(arr.get(curr).equals(arr.get(i))) (arr.get(curr).equals(arr.get(i))) arr.get(curr).equals arr.get(curr) arr.get arr curr arr.get(i) arr.get arr i {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			} dif = i - curr dif i - curr i curr count += dif*(dif-1)/2 count dif*(dif-1)/2 dif*(dif-1) dif (dif-1) dif 1 2 curr = i curr i dif = input-curr dif input-curr input curr count += dif*(dif-1)/2 count dif*(dif-1)/2 dif*(dif-1) dif (dif-1) dif 1 2 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 input = sc.nextInt();
		ArrayList<String> arr = new ArrayList<>();
		long count = 0;
		sc.nextLine();
		for(int i = 0;i<input;i++) {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		}
		Collections.sort(arr);
		long dif = 0;
		int curr = 0;
		for(int i = 1;i<arr.size();i++) {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		}
		dif = input-curr;
		count += dif*(dif-1)/2;
		System.out.println(count);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		ArrayList<String> arr = new ArrayList<>();
		long count = 0;
		sc.nextLine();
		for(int i = 0;i<input;i++) {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		}
		Collections.sort(arr);
		long dif = 0;
		int curr = 0;
		for(int i = 1;i<arr.size();i++) {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		}
		dif = input-curr;
		count += dif*(dif-1)/2;
		System.out.println(count);
	}

} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		ArrayList<String> arr = new ArrayList<>();
		long count = 0;
		sc.nextLine();
		for(int i = 0;i<input;i++) {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		}
		Collections.sort(arr);
		long dif = 0;
		int curr = 0;
		for(int i = 1;i<arr.size();i++) {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		}
		dif = input-curr;
		count += dif*(dif-1)/2;
		System.out.println(count);
	}

}
