import java.util.*;

public class Main {
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[][] s = new char[n][10];
		HashMap<String,Long> h = new HashMap<>();
		long ans=0;
		
		for(int i=0;i<n;i++) {
			s[i] = sc.next().toCharArray();
			Arrays.parallelSort(s[i]);
			String st = String.valueOf(s[i]);
			if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1);
			

		}
		
		System.out.println(ans);
		sc.close();
	}
		


} import java.util.*; util.* java public class Main {
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[][] s = new char[n][10];
		HashMap<String,Long> h = new HashMap<>();
		long ans=0;
		
		for(int i=0;i<n;i++) {
			s[i] = sc.next().toCharArray();
			Arrays.parallelSort(s[i]);
			String st = String.valueOf(s[i]);
			if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1);
			

		}
		
		System.out.println(ans);
		sc.close();
	}
		


} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[][] s = new char[n][10];
		HashMap<String,Long> h = new HashMap<>();
		long ans=0;
		
		for(int i=0;i<n;i++) {
			s[i] = sc.next().toCharArray();
			Arrays.parallelSort(s[i]);
			String st = String.valueOf(s[i]);
			if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1);
			

		}
		
		System.out.println(ans);
		sc.close();
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[][] s = new char[n][10];
		HashMap<String,Long> h = new HashMap<>();
		long ans=0;
		
		for(int i=0;i<n;i++) {
			s[i] = sc.next().toCharArray();
			Arrays.parallelSort(s[i]);
			String st = String.valueOf(s[i]);
			if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1);
			

		}
		
		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc char[][] s = new char[n][10]; s new char[n][10] n 10 HashMap<String,Long> h = new HashMap<>(); h new HashMap<>() long ans=0; ans 0 for(int i=0;i<n;i++) {
			s[i] = sc.next().toCharArray();
			Arrays.parallelSort(s[i]);
			String st = String.valueOf(s[i]);
			if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1);
			

		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			s[i] = sc.next().toCharArray();
			Arrays.parallelSort(s[i]);
			String st = String.valueOf(s[i]);
			if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1);
			

		} {
			s[i] = sc.next().toCharArray();
			Arrays.parallelSort(s[i]);
			String st = String.valueOf(s[i]);
			if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1);
			

		} s[i] = sc.next().toCharArray() s[i] s i sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.parallelSort(s[i]) Arrays.parallelSort Arrays s[i] s i String st = String.valueOf(s[i]); st String.valueOf(s[i]) String.valueOf String s[i] s i if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1); h.containsKey(st) h.containsKey h st {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			} long temp = h.get(st); temp h.get(st) h.get h st ans+=temp ans temp h.put(st,temp+1) h.put h st temp+1 temp 1 h.put(st,(long)1) h.put h st (long)1 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[][] s = new char[n][10];
		HashMap<String,Long> h = new HashMap<>();
		long ans=0;
		
		for(int i=0;i<n;i++) {
			s[i] = sc.next().toCharArray();
			Arrays.parallelSort(s[i]);
			String st = String.valueOf(s[i]);
			if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1);
			

		}
		
		System.out.println(ans);
		sc.close();
	}
		


} public class Main {
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[][] s = new char[n][10];
		HashMap<String,Long> h = new HashMap<>();
		long ans=0;
		
		for(int i=0;i<n;i++) {
			s[i] = sc.next().toCharArray();
			Arrays.parallelSort(s[i]);
			String st = String.valueOf(s[i]);
			if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1);
			

		}
		
		System.out.println(ans);
		sc.close();
	}
		


} Main
import java.util.*;

public class Main {
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[][] s = new char[n][10];
		HashMap<String,Long> h = new HashMap<>();
		long ans=0;
		
		for(int i=0;i<n;i++) {
			s[i] = sc.next().toCharArray();
			Arrays.parallelSort(s[i]);
			String st = String.valueOf(s[i]);
			if(h.containsKey(st)) {
				long temp = h.get(st);
				ans+=temp;
				h.put(st,temp+1);
			}else h.put(st,(long)1);
			

		}
		
		System.out.println(ans);
		sc.close();
	}
		


}
