import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main { 

	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int numberCount = Integer.parseInt(sc.nextLine());
    	
    	Map<String,Long> map = new HashMap<>();
    	long result = 0;
    	for(int i = 1;i<=numberCount;i++) {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	}
    	System.out.println(result);
    	
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main { 

	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int numberCount = Integer.parseInt(sc.nextLine());
    	
    	Map<String,Long> map = new HashMap<>();
    	long result = 0;
    	for(int i = 1;i<=numberCount;i++) {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	}
    	System.out.println(result);
    	
	}
} Main public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int numberCount = Integer.parseInt(sc.nextLine());
    	
    	Map<String,Long> map = new HashMap<>();
    	long result = 0;
    	for(int i = 1;i<=numberCount;i++) {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	}
    	System.out.println(result);
    	
	} main {
    	Scanner sc = new Scanner(System.in);
    	int numberCount = Integer.parseInt(sc.nextLine());
    	
    	Map<String,Long> map = new HashMap<>();
    	long result = 0;
    	for(int i = 1;i<=numberCount;i++) {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	}
    	System.out.println(result);
    	
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int numberCount = Integer.parseInt(sc.nextLine()); numberCount Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc Map<String,Long> map = new HashMap<>(); map new HashMap<>() long result = 0; result 0 for(int i = 1;i<=numberCount;i++) {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	} int i = 1; int i = 1; i 1 i<=numberCount i numberCount i++ i++ i {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	} {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	} String eachLine = sc.nextLine(); eachLine sc.nextLine() sc.nextLine sc char[] charLine = eachLine.toCharArray(); charLine eachLine.toCharArray() eachLine.toCharArray eachLine Arrays.sort(charLine) Arrays.sort Arrays charLine String sortedLine = new String(charLine); sortedLine new String(charLine) if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		} map.containsKey(sortedLine) map.containsKey map sortedLine {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		} long tmp = map.get(sortedLine)+1; tmp map.get(sortedLine)+1 map.get(sortedLine) map.get map sortedLine 1 result = result + tmp result result + tmp result tmp map.put(sortedLine, tmp) map.put map sortedLine tmp {
    			map.put(sortedLine, 0l);
    		} map.put(sortedLine, 0l) map.put map sortedLine 0l System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main { 

	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int numberCount = Integer.parseInt(sc.nextLine());
    	
    	Map<String,Long> map = new HashMap<>();
    	long result = 0;
    	for(int i = 1;i<=numberCount;i++) {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	}
    	System.out.println(result);
    	
	}
} public class Main { 

	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int numberCount = Integer.parseInt(sc.nextLine());
    	
    	Map<String,Long> map = new HashMap<>();
    	long result = 0;
    	for(int i = 1;i<=numberCount;i++) {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	}
    	System.out.println(result);
    	
	}
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main { 

	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int numberCount = Integer.parseInt(sc.nextLine());
    	
    	Map<String,Long> map = new HashMap<>();
    	long result = 0;
    	for(int i = 1;i<=numberCount;i++) {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	}
    	System.out.println(result);
    	
	}
}