import java.util.*;	
public class Main {
public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		String[] s=new String[N];
		String[] sorts=new String[N];
		String[][] splits=new String[N][10];
		
		long count=0;
		int count1=0;
		for(int i=0; i<N; i++) {
			s[i]=sc.next();
			splits[i]=s[i].split("");
			Arrays.sort(splits[i]);
			for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			}
			
		}
		Arrays.sort(sorts);
		for(int i=0;i<N-1;i++) {
			if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		}			
			
		}
		System.out.println(count);
	  }	          	
} import java.util.*; util.* java public class Main {
public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		String[] s=new String[N];
		String[] sorts=new String[N];
		String[][] splits=new String[N][10];
		
		long count=0;
		int count1=0;
		for(int i=0; i<N; i++) {
			s[i]=sc.next();
			splits[i]=s[i].split("");
			Arrays.sort(splits[i]);
			for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			}
			
		}
		Arrays.sort(sorts);
		for(int i=0;i<N-1;i++) {
			if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		}			
			
		}
		System.out.println(count);
	  }	          	
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		String[] s=new String[N];
		String[] sorts=new String[N];
		String[][] splits=new String[N][10];
		
		long count=0;
		int count1=0;
		for(int i=0; i<N; i++) {
			s[i]=sc.next();
			splits[i]=s[i].split("");
			Arrays.sort(splits[i]);
			for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			}
			
		}
		Arrays.sort(sorts);
		for(int i=0;i<N-1;i++) {
			if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		}			
			
		}
		System.out.println(count);
	  } main {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		String[] s=new String[N];
		String[] sorts=new String[N];
		String[][] splits=new String[N][10];
		
		long count=0;
		int count1=0;
		for(int i=0; i<N; i++) {
			s[i]=sc.next();
			splits[i]=s[i].split("");
			Arrays.sort(splits[i]);
			for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			}
			
		}
		Arrays.sort(sorts);
		for(int i=0;i<N-1;i++) {
			if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		}			
			
		}
		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 String[] s=new String[N]; s new String[N] N String[] sorts=new String[N]; sorts new String[N] N String[][] splits=new String[N][10]; splits new String[N][10] N 10 long count=0; count 0 int count1=0; count1 0 for(int i=0; i<N; i++) {
			s[i]=sc.next();
			splits[i]=s[i].split("");
			Arrays.sort(splits[i]);
			for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			}
			
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			s[i]=sc.next();
			splits[i]=s[i].split("");
			Arrays.sort(splits[i]);
			for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			}
			
		} {
			s[i]=sc.next();
			splits[i]=s[i].split("");
			Arrays.sort(splits[i]);
			for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			}
			
		} s[i]=sc.next() s[i] s i sc.next() sc.next sc splits[i]=s[i].split("") splits[i] splits i s[i].split("") s[i].split s[i] s i "" Arrays.sort(splits[i]) Arrays.sort Arrays splits[i] splits i for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			} int j=0; int j=0; j 0 j<10 j 10 j++ j++ j {
				sorts[i]+=splits[i][j];
			} {
				sorts[i]+=splits[i][j];
			} sorts[i]+=splits[i][j] sorts[i] sorts i splits[i][j] splits[i] splits i j Arrays.sort(sorts) Arrays.sort Arrays sorts for(int i=0;i<N-1;i++) {
			if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		}			
			
		} int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
			if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		}			
			
		} {
			if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		}			
			
		} if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		} sorts[i].equals(sorts[i+1]) sorts[i].equals sorts[i] sorts i sorts[i+1] sorts i+1 i 1 {
			        count1++;
					count+=count1;
			} count1++ count1 count+=count1 count count1 {		
				count1=0;
		} count1=0 count1 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);
		int N=sc.nextInt();
		String[] s=new String[N];
		String[] sorts=new String[N];
		String[][] splits=new String[N][10];
		
		long count=0;
		int count1=0;
		for(int i=0; i<N; i++) {
			s[i]=sc.next();
			splits[i]=s[i].split("");
			Arrays.sort(splits[i]);
			for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			}
			
		}
		Arrays.sort(sorts);
		for(int i=0;i<N-1;i++) {
			if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		}			
			
		}
		System.out.println(count);
	  }	          	
} public class Main {
public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		String[] s=new String[N];
		String[] sorts=new String[N];
		String[][] splits=new String[N][10];
		
		long count=0;
		int count1=0;
		for(int i=0; i<N; i++) {
			s[i]=sc.next();
			splits[i]=s[i].split("");
			Arrays.sort(splits[i]);
			for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			}
			
		}
		Arrays.sort(sorts);
		for(int i=0;i<N-1;i++) {
			if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		}			
			
		}
		System.out.println(count);
	  }	          	
} Main
import java.util.*;	
public class Main {
public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		String[] s=new String[N];
		String[] sorts=new String[N];
		String[][] splits=new String[N][10];
		
		long count=0;
		int count1=0;
		for(int i=0; i<N; i++) {
			s[i]=sc.next();
			splits[i]=s[i].split("");
			Arrays.sort(splits[i]);
			for(int j=0; j<10; j++) {
				sorts[i]+=splits[i][j];
			}
			
		}
		Arrays.sort(sorts);
		for(int i=0;i<N-1;i++) {
			if(sorts[i].equals(sorts[i+1])) {
			        count1++;
					count+=count1;
			}else {		
				count1=0;
		}			
			
		}
		System.out.println(count);
	  }	          	
}