
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<String,Integer >cnt = new HashMap<>();
		int a = sc.nextInt();
		long answer = 0;
		
		for(int i=0;i<a;i++) {
			String b = sc.next();
			char[] str = new char[10];
			for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			}
			Arrays.sort(str);
			String s = String.valueOf(str);
			Integer n = cnt.get(s);
			if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			}
			
			
		}
		
		System.out.println(answer);
		
		
		
		/*int samecnt = 0;
		for(int i=0;i<a;i++) {
			for(int j=i+1;j<a;j++) {
				if(s[i].equals(s[j])) {
					samecnt++;
				}else {
					break;
				}
			}
		}
		
		
		System.out.println(samecnt);*/
		sc.close();

	}

} import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap 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);
		Map<String,Integer >cnt = new HashMap<>();
		int a = sc.nextInt();
		long answer = 0;
		
		for(int i=0;i<a;i++) {
			String b = sc.next();
			char[] str = new char[10];
			for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			}
			Arrays.sort(str);
			String s = String.valueOf(str);
			Integer n = cnt.get(s);
			if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			}
			
			
		}
		
		System.out.println(answer);
		
		
		
		/*int samecnt = 0;
		for(int i=0;i<a;i++) {
			for(int j=i+1;j<a;j++) {
				if(s[i].equals(s[j])) {
					samecnt++;
				}else {
					break;
				}
			}
		}
		
		
		System.out.println(samecnt);*/
		sc.close();

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<String,Integer >cnt = new HashMap<>();
		int a = sc.nextInt();
		long answer = 0;
		
		for(int i=0;i<a;i++) {
			String b = sc.next();
			char[] str = new char[10];
			for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			}
			Arrays.sort(str);
			String s = String.valueOf(str);
			Integer n = cnt.get(s);
			if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			}
			
			
		}
		
		System.out.println(answer);
		
		
		
		/*int samecnt = 0;
		for(int i=0;i<a;i++) {
			for(int j=i+1;j<a;j++) {
				if(s[i].equals(s[j])) {
					samecnt++;
				}else {
					break;
				}
			}
		}
		
		
		System.out.println(samecnt);*/
		sc.close();

	} main {
		Scanner sc = new Scanner(System.in);
		Map<String,Integer >cnt = new HashMap<>();
		int a = sc.nextInt();
		long answer = 0;
		
		for(int i=0;i<a;i++) {
			String b = sc.next();
			char[] str = new char[10];
			for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			}
			Arrays.sort(str);
			String s = String.valueOf(str);
			Integer n = cnt.get(s);
			if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			}
			
			
		}
		
		System.out.println(answer);
		
		
		
		/*int samecnt = 0;
		for(int i=0;i<a;i++) {
			for(int j=i+1;j<a;j++) {
				if(s[i].equals(s[j])) {
					samecnt++;
				}else {
					break;
				}
			}
		}
		
		
		System.out.println(samecnt);*/
		sc.close();

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Map<String,Integer >cnt = new HashMap<>(); cnt new HashMap<>() int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc long answer = 0; answer 0 for(int i=0;i<a;i++) {
			String b = sc.next();
			char[] str = new char[10];
			for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			}
			Arrays.sort(str);
			String s = String.valueOf(str);
			Integer n = cnt.get(s);
			if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			}
			
			
		} int i=0; int i=0; i 0 i<a i a i++ i++ i {
			String b = sc.next();
			char[] str = new char[10];
			for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			}
			Arrays.sort(str);
			String s = String.valueOf(str);
			Integer n = cnt.get(s);
			if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			}
			
			
		} {
			String b = sc.next();
			char[] str = new char[10];
			for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			}
			Arrays.sort(str);
			String s = String.valueOf(str);
			Integer n = cnt.get(s);
			if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			}
			
			
		} String b = sc.next(); b sc.next() sc.next sc char[] str = new char[10]; str new char[10] 10 for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			} int j=0; int j=0; j 0 j<10 j 10 j++ j++ j {
				str[j] = b.charAt(j);
			} {
				str[j] = b.charAt(j);
			} str[j] = b.charAt(j) str[j] str j b.charAt(j) b.charAt b j Arrays.sort(str) Arrays.sort Arrays str String s = String.valueOf(str); s String.valueOf(str) String.valueOf String str Integer n = cnt.get(s); n cnt.get(s) cnt.get cnt s if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			} n == null n null {
				cnt.put(s,1);
			} cnt.put(s,1) cnt.put cnt s 1 {
				answer += n;
				cnt.put(s,n+1);
			} answer += n answer n cnt.put(s,n+1) cnt.put cnt s n+1 n 1 System.out.println(answer) System.out.println System.out System System.out answer sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<String,Integer >cnt = new HashMap<>();
		int a = sc.nextInt();
		long answer = 0;
		
		for(int i=0;i<a;i++) {
			String b = sc.next();
			char[] str = new char[10];
			for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			}
			Arrays.sort(str);
			String s = String.valueOf(str);
			Integer n = cnt.get(s);
			if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			}
			
			
		}
		
		System.out.println(answer);
		
		
		
		/*int samecnt = 0;
		for(int i=0;i<a;i++) {
			for(int j=i+1;j<a;j++) {
				if(s[i].equals(s[j])) {
					samecnt++;
				}else {
					break;
				}
			}
		}
		
		
		System.out.println(samecnt);*/
		sc.close();

	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<String,Integer >cnt = new HashMap<>();
		int a = sc.nextInt();
		long answer = 0;
		
		for(int i=0;i<a;i++) {
			String b = sc.next();
			char[] str = new char[10];
			for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			}
			Arrays.sort(str);
			String s = String.valueOf(str);
			Integer n = cnt.get(s);
			if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			}
			
			
		}
		
		System.out.println(answer);
		
		
		
		/*int samecnt = 0;
		for(int i=0;i<a;i++) {
			for(int j=i+1;j<a;j++) {
				if(s[i].equals(s[j])) {
					samecnt++;
				}else {
					break;
				}
			}
		}
		
		
		System.out.println(samecnt);*/
		sc.close();

	}

} Main

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<String,Integer >cnt = new HashMap<>();
		int a = sc.nextInt();
		long answer = 0;
		
		for(int i=0;i<a;i++) {
			String b = sc.next();
			char[] str = new char[10];
			for(int j=0;j<10;j++) {
				str[j] = b.charAt(j);
			}
			Arrays.sort(str);
			String s = String.valueOf(str);
			Integer n = cnt.get(s);
			if(n == null) {
				cnt.put(s,1);
			}else {
				answer += n;
				cnt.put(s,n+1);
			}
			
			
		}
		
		System.out.println(answer);
		
		
		
		/*int samecnt = 0;
		for(int i=0;i<a;i++) {
			for(int j=i+1;j<a;j++) {
				if(s[i].equals(s[j])) {
					samecnt++;
				}else {
					break;
				}
			}
		}
		
		
		System.out.println(samecnt);*/
		sc.close();

	}

}
