import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
      	long ans=0;

  		char[][] ch=new char[n][10];
  		String[] s=new String[n];
		for(int c=0;c<n;c++){
    		ch[c]=sc.next().toCharArray();
          	Arrays.sort(ch[c]);
          	s[c]=String.valueOf(ch[c]);	
    	}
  		Arrays.sort(s);
  		long count=0;
  		int d=0;
  		while(d<n){
    	for(int e=d+1;e<n;e++){
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        }
           ans+=count*(count+1)/2;
           d+=count+1;
           count=0;
        }
    	System.out.println(ans);
    }
} import java.util.*; util.* java class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
      	long ans=0;

  		char[][] ch=new char[n][10];
  		String[] s=new String[n];
		for(int c=0;c<n;c++){
    		ch[c]=sc.next().toCharArray();
          	Arrays.sort(ch[c]);
          	s[c]=String.valueOf(ch[c]);	
    	}
  		Arrays.sort(s);
  		long count=0;
  		int d=0;
  		while(d<n){
    	for(int e=d+1;e<n;e++){
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        }
           ans+=count*(count+1)/2;
           d+=count+1;
           count=0;
        }
    	System.out.println(ans);
    }
} Main public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
      	long ans=0;

  		char[][] ch=new char[n][10];
  		String[] s=new String[n];
		for(int c=0;c<n;c++){
    		ch[c]=sc.next().toCharArray();
          	Arrays.sort(ch[c]);
          	s[c]=String.valueOf(ch[c]);	
    	}
  		Arrays.sort(s);
  		long count=0;
  		int d=0;
  		while(d<n){
    	for(int e=d+1;e<n;e++){
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        }
           ans+=count*(count+1)/2;
           d+=count+1;
           count=0;
        }
    	System.out.println(ans);
    } main {
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
      	long ans=0;

  		char[][] ch=new char[n][10];
  		String[] s=new String[n];
		for(int c=0;c<n;c++){
    		ch[c]=sc.next().toCharArray();
          	Arrays.sort(ch[c]);
          	s[c]=String.valueOf(ch[c]);	
    	}
  		Arrays.sort(s);
  		long count=0;
  		int d=0;
  		while(d<n){
    	for(int e=d+1;e<n;e++){
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        }
           ans+=count*(count+1)/2;
           d+=count+1;
           count=0;
        }
    	System.out.println(ans);
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc long ans=0; ans 0 char[][] ch=new char[n][10]; ch new char[n][10] n 10 String[] s=new String[n]; s new String[n] n for(int c=0;c<n;c++){
    		ch[c]=sc.next().toCharArray();
          	Arrays.sort(ch[c]);
          	s[c]=String.valueOf(ch[c]);	
    	} int c=0; int c=0; c 0 c<n c n c++ c++ c {
    		ch[c]=sc.next().toCharArray();
          	Arrays.sort(ch[c]);
          	s[c]=String.valueOf(ch[c]);	
    	} {
    		ch[c]=sc.next().toCharArray();
          	Arrays.sort(ch[c]);
          	s[c]=String.valueOf(ch[c]);	
    	} ch[c]=sc.next().toCharArray() ch[c] ch c sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(ch[c]) Arrays.sort Arrays ch[c] ch c s[c]=String.valueOf(ch[c]) s[c] s c String.valueOf(ch[c]) String.valueOf String ch[c] ch c Arrays.sort(s) Arrays.sort Arrays s long count=0; count 0 int d=0; d 0 while(d<n){
    	for(int e=d+1;e<n;e++){
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        }
           ans+=count*(count+1)/2;
           d+=count+1;
           count=0;
        } d<n d n {
    	for(int e=d+1;e<n;e++){
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        }
           ans+=count*(count+1)/2;
           d+=count+1;
           count=0;
        } for(int e=d+1;e<n;e++){
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        } int e=d+1; int e=d+1; e d+1 d 1 e<n e n e++ e++ e {
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        } {
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        } if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 } s[d].equals(s[e]) s[d].equals s[d] s d s[e] s e {
    		count++;
    	} count++ count {
     		break;
   		 } break; ans+=count*(count+1)/2 ans count*(count+1)/2 count*(count+1) count (count+1) count 1 2 d+=count+1 d count+1 count 1 count=0 count 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
      	long ans=0;

  		char[][] ch=new char[n][10];
  		String[] s=new String[n];
		for(int c=0;c<n;c++){
    		ch[c]=sc.next().toCharArray();
          	Arrays.sort(ch[c]);
          	s[c]=String.valueOf(ch[c]);	
    	}
  		Arrays.sort(s);
  		long count=0;
  		int d=0;
  		while(d<n){
    	for(int e=d+1;e<n;e++){
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        }
           ans+=count*(count+1)/2;
           d+=count+1;
           count=0;
        }
    	System.out.println(ans);
    }
}