import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			String[]s = new String[N];
			char[][] o = new char[N][10];
			
			for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			}
			
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			Arrays.sort(s);
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			
			
			
			
			
			
			
			long count = 1;
			long goukeikumiawase = 0;
			
			for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				}
				
				
				
				
				
			
			
			
			
			System.out.println(goukeikumiawase);
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		}
		
		
	}
	
	
	
	private static long combinations(long n,long k){//(0<k&&k<n) 
		if(k==n){
			return 1;
		}else if(k==1) {
			return n;
		}
			return combinations(n-1, k-1)+combinations(n-1, k);
			
		}
	
	
	
	
		

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			String[]s = new String[N];
			char[][] o = new char[N][10];
			
			for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			}
			
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			Arrays.sort(s);
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			
			
			
			
			
			
			
			long count = 1;
			long goukeikumiawase = 0;
			
			for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				}
				
				
				
				
				
			
			
			
			
			System.out.println(goukeikumiawase);
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		}
		
		
	}
	
	
	
	private static long combinations(long n,long k){//(0<k&&k<n) 
		if(k==n){
			return 1;
		}else if(k==1) {
			return n;
		}
			return combinations(n-1, k-1)+combinations(n-1, k);
			
		}
	
	
	
	
		

} Main public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			String[]s = new String[N];
			char[][] o = new char[N][10];
			
			for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			}
			
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			Arrays.sort(s);
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			
			
			
			
			
			
			
			long count = 1;
			long goukeikumiawase = 0;
			
			for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				}
				
				
				
				
				
			
			
			
			
			System.out.println(goukeikumiawase);
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		}
		
		
	} main {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			String[]s = new String[N];
			char[][] o = new char[N][10];
			
			for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			}
			
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			Arrays.sort(s);
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			
			
			
			
			
			
			
			long count = 1;
			long goukeikumiawase = 0;
			
			for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				}
				
				
				
				
				
			
			
			
			
			System.out.println(goukeikumiawase);
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		}
		
		
	} try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			String[]s = new String[N];
			char[][] o = new char[N][10];
			
			for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			}
			
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			Arrays.sort(s);
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			
			
			
			
			
			
			
			long count = 1;
			long goukeikumiawase = 0;
			
			for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				}
				
				
				
				
				
			
			
			
			
			System.out.println(goukeikumiawase);
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		} {
			int N = scan.nextInt();
			String[]s = new String[N];
			char[][] o = new char[N][10];
			
			for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			}
			
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			Arrays.sort(s);
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			
			
			
			
			
			
			
			long count = 1;
			long goukeikumiawase = 0;
			
			for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				}
				
				
				
				
				
			
			
			
			
			System.out.println(goukeikumiawase);
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		} Scanner scan = new Scanner(System.in) Scanner scan = new Scanner(System.in) new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan String[]s = new String[N]; s new String[N] N char[][] o = new char[N][10]; o new char[N][10] N 10 for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			} {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			} s[i] = scan.next() s[i] s i scan.next() scan.next scan o[i] =s[i].toCharArray() o[i] o i s[i].toCharArray() s[i].toCharArray s[i] s i Arrays.sort(o[i]) Arrays.sort Arrays o[i] o i s[i] = new String(o[i]) s[i] s i new String(o[i]) for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {

				//System.out.println(s[i]);
			} {

				//System.out.println(s[i]);
			} Arrays.sort(s) Arrays.sort Arrays s for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {

				//System.out.println(s[i]);
			} {

				//System.out.println(s[i]);
			} long count = 1; count 1 long goukeikumiawase = 0; goukeikumiawase 0 for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				} int i=1; int i=1; i 1 i<=N-1 i N-1 N 1 i++ i++ i {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				} {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				} if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				} s[i].equals(s[i-1]) s[i].equals s[i] s i s[i-1] s i-1 i 1 {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				} count++ count if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					} i==N-1 i N-1 N 1 {
						goukeikumiawase+=combinations(count,2);
					} goukeikumiawase+=combinations(count,2) goukeikumiawase combinations(count,2) combinations count 2 if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				} !s[i].equals(s[i-1]) s[i].equals(s[i-1]) s[i].equals s[i] s i s[i-1] s i-1 i 1 {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				} if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					} count>=2 count 2 {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					} goukeikumiawase+=combinations(count,2) goukeikumiawase combinations(count,2) combinations count 2 count =1 count 1 System.out.println(goukeikumiawase) System.out.println System.out System System.out goukeikumiawase String[]args args private static long combinations(long n,long k){//(0<k&&k<n) 
		if(k==n){
			return 1;
		}else if(k==1) {
			return n;
		}
			return combinations(n-1, k-1)+combinations(n-1, k);
			
		} combinations {//(0<k&&k<n) 
		if(k==n){
			return 1;
		}else if(k==1) {
			return n;
		}
			return combinations(n-1, k-1)+combinations(n-1, k);
			
		} if(k==n){
			return 1;
		}else if(k==1) {
			return n;
		} k==n k n {
			return 1;
		} return 1; 1 if(k==1) {
			return n;
		} k==1 k 1 {
			return n;
		} return n; n return combinations(n-1, k-1)+combinations(n-1, k); combinations(n-1, k-1)+combinations(n-1, k) combinations(n-1, k-1) combinations n-1 n 1 k-1 k 1 combinations(n-1, k) combinations n-1 n 1 k long n n long k k public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			String[]s = new String[N];
			char[][] o = new char[N][10];
			
			for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			}
			
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			Arrays.sort(s);
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			
			
			
			
			
			
			
			long count = 1;
			long goukeikumiawase = 0;
			
			for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				}
				
				
				
				
				
			
			
			
			
			System.out.println(goukeikumiawase);
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		}
		
		
	}
	
	
	
	private static long combinations(long n,long k){//(0<k&&k<n) 
		if(k==n){
			return 1;
		}else if(k==1) {
			return n;
		}
			return combinations(n-1, k-1)+combinations(n-1, k);
			
		}
	
	
	
	
		

} public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			String[]s = new String[N];
			char[][] o = new char[N][10];
			
			for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			}
			
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			Arrays.sort(s);
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			
			
			
			
			
			
			
			long count = 1;
			long goukeikumiawase = 0;
			
			for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				}
				
				
				
				
				
			
			
			
			
			System.out.println(goukeikumiawase);
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		}
		
		
	}
	
	
	
	private static long combinations(long n,long k){//(0<k&&k<n) 
		if(k==n){
			return 1;
		}else if(k==1) {
			return n;
		}
			return combinations(n-1, k-1)+combinations(n-1, k);
			
		}
	
	
	
	
		

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			String[]s = new String[N];
			char[][] o = new char[N][10];
			
			for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			}
			
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			Arrays.sort(s);
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			
			
			
			
			
			
			
			long count = 1;
			long goukeikumiawase = 0;
			
			for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				}
				
				
				
				
				
			
			
			
			
			System.out.println(goukeikumiawase);
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		}
		
		
	}
	
	
	
	private static long combinations(long n,long k){//(0<k&&k<n) 
		if(k==n){
			return 1;
		}else if(k==1) {
			return n;
		}
			return combinations(n-1, k-1)+combinations(n-1, k);
			
		}
	
	
	
	
		

}
