import java.util.*; 


public class Main
 {
	public static void main (String[] args)
	 {
	    Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    in.nextLine();
	    String[] A = new String[n];
	    
	    
	    for(int i=0;i<n;i++) {
	    	A[i] = in.nextLine();
	    	
	    }
	    
	    for(int i=0;i<n;i++) {
	    	char[] stringArray = A[i].toCharArray();
	    	Arrays.sort(stringArray);
	    	A[i] = new String(stringArray);
	    }
	    
	    Arrays.sort(A);
	    long ans = 0;
	    
	    long count = 1;
	    String current = "";
	    for(int i=0;i<n;i++) {
	    	if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	}
	    	current = A[i];
	    	
	    }
	    ans+= count*(count-1)/2;
	   
	    System.out.println(ans);
	 }
	
	
	
	
	
	
	 

}


 import java.util.*; util.* java public class Main
 {
	public static void main (String[] args)
	 {
	    Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    in.nextLine();
	    String[] A = new String[n];
	    
	    
	    for(int i=0;i<n;i++) {
	    	A[i] = in.nextLine();
	    	
	    }
	    
	    for(int i=0;i<n;i++) {
	    	char[] stringArray = A[i].toCharArray();
	    	Arrays.sort(stringArray);
	    	A[i] = new String(stringArray);
	    }
	    
	    Arrays.sort(A);
	    long ans = 0;
	    
	    long count = 1;
	    String current = "";
	    for(int i=0;i<n;i++) {
	    	if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	}
	    	current = A[i];
	    	
	    }
	    ans+= count*(count-1)/2;
	   
	    System.out.println(ans);
	 }
	
	
	
	
	
	
	 

} Main public static void main (String[] args)
	 {
	    Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    in.nextLine();
	    String[] A = new String[n];
	    
	    
	    for(int i=0;i<n;i++) {
	    	A[i] = in.nextLine();
	    	
	    }
	    
	    for(int i=0;i<n;i++) {
	    	char[] stringArray = A[i].toCharArray();
	    	Arrays.sort(stringArray);
	    	A[i] = new String(stringArray);
	    }
	    
	    Arrays.sort(A);
	    long ans = 0;
	    
	    long count = 1;
	    String current = "";
	    for(int i=0;i<n;i++) {
	    	if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	}
	    	current = A[i];
	    	
	    }
	    ans+= count*(count-1)/2;
	   
	    System.out.println(ans);
	 } main {
	    Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    in.nextLine();
	    String[] A = new String[n];
	    
	    
	    for(int i=0;i<n;i++) {
	    	A[i] = in.nextLine();
	    	
	    }
	    
	    for(int i=0;i<n;i++) {
	    	char[] stringArray = A[i].toCharArray();
	    	Arrays.sort(stringArray);
	    	A[i] = new String(stringArray);
	    }
	    
	    Arrays.sort(A);
	    long ans = 0;
	    
	    long count = 1;
	    String current = "";
	    for(int i=0;i<n;i++) {
	    	if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	}
	    	current = A[i];
	    	
	    }
	    ans+= count*(count-1)/2;
	   
	    System.out.println(ans);
	 } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in in.nextLine() in.nextLine in String[] A = new String[n]; A new String[n] n for(int i=0;i<n;i++) {
	    	A[i] = in.nextLine();
	    	
	    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
	    	A[i] = in.nextLine();
	    	
	    } {
	    	A[i] = in.nextLine();
	    	
	    } A[i] = in.nextLine() A[i] A i in.nextLine() in.nextLine in for(int i=0;i<n;i++) {
	    	char[] stringArray = A[i].toCharArray();
	    	Arrays.sort(stringArray);
	    	A[i] = new String(stringArray);
	    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
	    	char[] stringArray = A[i].toCharArray();
	    	Arrays.sort(stringArray);
	    	A[i] = new String(stringArray);
	    } {
	    	char[] stringArray = A[i].toCharArray();
	    	Arrays.sort(stringArray);
	    	A[i] = new String(stringArray);
	    } char[] stringArray = A[i].toCharArray(); stringArray A[i].toCharArray() A[i].toCharArray A[i] A i Arrays.sort(stringArray) Arrays.sort Arrays stringArray A[i] = new String(stringArray) A[i] A i new String(stringArray) Arrays.sort(A) Arrays.sort Arrays A long ans = 0; ans 0 long count = 1; count 1 String current = ""; current "" for(int i=0;i<n;i++) {
	    	if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	}
	    	current = A[i];
	    	
	    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
	    	if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	}
	    	current = A[i];
	    	
	    } {
	    	if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	}
	    	current = A[i];
	    	
	    } if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	} !current.equals(A[i]) current.equals(A[i]) current.equals current A[i] A i {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	} ans += count*(count-1)/2 ans count*(count-1)/2 count*(count-1) count (count-1) count 1 2 count = 1 count 1 {
	    		count++;
	    	} count++ count current = A[i] current A[i] A i ans+= count*(count-1)/2 ans count*(count-1)/2 count*(count-1) count (count-1) count 1 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main
 {
	public static void main (String[] args)
	 {
	    Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    in.nextLine();
	    String[] A = new String[n];
	    
	    
	    for(int i=0;i<n;i++) {
	    	A[i] = in.nextLine();
	    	
	    }
	    
	    for(int i=0;i<n;i++) {
	    	char[] stringArray = A[i].toCharArray();
	    	Arrays.sort(stringArray);
	    	A[i] = new String(stringArray);
	    }
	    
	    Arrays.sort(A);
	    long ans = 0;
	    
	    long count = 1;
	    String current = "";
	    for(int i=0;i<n;i++) {
	    	if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	}
	    	current = A[i];
	    	
	    }
	    ans+= count*(count-1)/2;
	   
	    System.out.println(ans);
	 }
	
	
	
	
	
	
	 

} public class Main
 {
	public static void main (String[] args)
	 {
	    Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    in.nextLine();
	    String[] A = new String[n];
	    
	    
	    for(int i=0;i<n;i++) {
	    	A[i] = in.nextLine();
	    	
	    }
	    
	    for(int i=0;i<n;i++) {
	    	char[] stringArray = A[i].toCharArray();
	    	Arrays.sort(stringArray);
	    	A[i] = new String(stringArray);
	    }
	    
	    Arrays.sort(A);
	    long ans = 0;
	    
	    long count = 1;
	    String current = "";
	    for(int i=0;i<n;i++) {
	    	if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	}
	    	current = A[i];
	    	
	    }
	    ans+= count*(count-1)/2;
	   
	    System.out.println(ans);
	 }
	
	
	
	
	
	
	 

} Main
import java.util.*; 


public class Main
 {
	public static void main (String[] args)
	 {
	    Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    in.nextLine();
	    String[] A = new String[n];
	    
	    
	    for(int i=0;i<n;i++) {
	    	A[i] = in.nextLine();
	    	
	    }
	    
	    for(int i=0;i<n;i++) {
	    	char[] stringArray = A[i].toCharArray();
	    	Arrays.sort(stringArray);
	    	A[i] = new String(stringArray);
	    }
	    
	    Arrays.sort(A);
	    long ans = 0;
	    
	    long count = 1;
	    String current = "";
	    for(int i=0;i<n;i++) {
	    	if(!current.equals(A[i])) {
	    		ans += count*(count-1)/2;
	    		count = 1;
	    		
	    		
	    		
	    	}
	    	else {
	    		count++;
	    	}
	    	current = A[i];
	    	
	    }
	    ans+= count*(count-1)/2;
	   
	    System.out.println(ans);
	 }
	
	
	
	
	
	
	 

}



