import java.io.PrintWriter;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int N = Integer.parseInt(stdin.next());
		String s[] = new String[N];
		long cnt = 0;
		
		
		for(int i=0;i<N;i++) {
			s[i] = stdin.next();
		}
		for(int h=0;h<N;h++) {
			char[] copy = s[h].toCharArray();
			Arrays.sort(copy);
			s[h] = new String(copy);
		}
		Arrays.sort(s);

		for(int i=0;i<N-1;i++) {
			int j=i+1;
			long sin=1;
			while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			}
			cnt+=(sin*(sin-1))/2;
			i=j-1;
		}

		out.println(cnt);

		out.flush();
	}

	
} import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int N = Integer.parseInt(stdin.next());
		String s[] = new String[N];
		long cnt = 0;
		
		
		for(int i=0;i<N;i++) {
			s[i] = stdin.next();
		}
		for(int h=0;h<N;h++) {
			char[] copy = s[h].toCharArray();
			Arrays.sort(copy);
			s[h] = new String(copy);
		}
		Arrays.sort(s);

		for(int i=0;i<N-1;i++) {
			int j=i+1;
			long sin=1;
			while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			}
			cnt+=(sin*(sin-1))/2;
			i=j-1;
		}

		out.println(cnt);

		out.flush();
	}

	
} Main public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int N = Integer.parseInt(stdin.next());
		String s[] = new String[N];
		long cnt = 0;
		
		
		for(int i=0;i<N;i++) {
			s[i] = stdin.next();
		}
		for(int h=0;h<N;h++) {
			char[] copy = s[h].toCharArray();
			Arrays.sort(copy);
			s[h] = new String(copy);
		}
		Arrays.sort(s);

		for(int i=0;i<N-1;i++) {
			int j=i+1;
			long sin=1;
			while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			}
			cnt+=(sin*(sin-1))/2;
			i=j-1;
		}

		out.println(cnt);

		out.flush();
	} main {
		Scanner stdin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int N = Integer.parseInt(stdin.next());
		String s[] = new String[N];
		long cnt = 0;
		
		
		for(int i=0;i<N;i++) {
			s[i] = stdin.next();
		}
		for(int h=0;h<N;h++) {
			char[] copy = s[h].toCharArray();
			Arrays.sort(copy);
			s[h] = new String(copy);
		}
		Arrays.sort(s);

		for(int i=0;i<N-1;i++) {
			int j=i+1;
			long sin=1;
			while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			}
			cnt+=(sin*(sin-1))/2;
			i=j-1;
		}

		out.println(cnt);

		out.flush();
	} Scanner stdin = new Scanner(System.in); stdin new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int N = Integer.parseInt(stdin.next()); N Integer.parseInt(stdin.next()) Integer.parseInt Integer stdin.next() stdin.next stdin String s[] = new String[N]; s new String[N] N long cnt = 0; cnt 0 for(int i=0;i<N;i++) {
			s[i] = stdin.next();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			s[i] = stdin.next();
		} {
			s[i] = stdin.next();
		} s[i] = stdin.next() s[i] s i stdin.next() stdin.next stdin for(int h=0;h<N;h++) {
			char[] copy = s[h].toCharArray();
			Arrays.sort(copy);
			s[h] = new String(copy);
		} int h=0; int h=0; h 0 h<N h N h++ h++ h {
			char[] copy = s[h].toCharArray();
			Arrays.sort(copy);
			s[h] = new String(copy);
		} {
			char[] copy = s[h].toCharArray();
			Arrays.sort(copy);
			s[h] = new String(copy);
		} char[] copy = s[h].toCharArray(); copy s[h].toCharArray() s[h].toCharArray s[h] s h Arrays.sort(copy) Arrays.sort Arrays copy s[h] = new String(copy) s[h] s h new String(copy) Arrays.sort(s) Arrays.sort Arrays s for(int i=0;i<N-1;i++) {
			int j=i+1;
			long sin=1;
			while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			}
			cnt+=(sin*(sin-1))/2;
			i=j-1;
		} int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
			int j=i+1;
			long sin=1;
			while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			}
			cnt+=(sin*(sin-1))/2;
			i=j-1;
		} {
			int j=i+1;
			long sin=1;
			while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			}
			cnt+=(sin*(sin-1))/2;
			i=j-1;
		} int j=i+1; j i+1 i 1 long sin=1; sin 1 while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			} s[i].equals(s[j]) s[i].equals s[i] s i s[j] s j {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			} if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					} j!=N-1 j N-1 N 1 {
						j+=1;
						sin+=1;
					} j+=1 j 1 sin+=1 sin 1 {
						sin+=1;
						break;
					} sin+=1 sin 1 break; cnt+=(sin*(sin-1))/2 cnt (sin*(sin-1))/2 (sin*(sin-1)) sin (sin-1) sin 1 2 i=j-1 i j-1 j 1 out.println(cnt) out.println out cnt out.flush() out.flush out String[] args args public class Main {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int N = Integer.parseInt(stdin.next());
		String s[] = new String[N];
		long cnt = 0;
		
		
		for(int i=0;i<N;i++) {
			s[i] = stdin.next();
		}
		for(int h=0;h<N;h++) {
			char[] copy = s[h].toCharArray();
			Arrays.sort(copy);
			s[h] = new String(copy);
		}
		Arrays.sort(s);

		for(int i=0;i<N-1;i++) {
			int j=i+1;
			long sin=1;
			while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			}
			cnt+=(sin*(sin-1))/2;
			i=j-1;
		}

		out.println(cnt);

		out.flush();
	}

	
} public class Main {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int N = Integer.parseInt(stdin.next());
		String s[] = new String[N];
		long cnt = 0;
		
		
		for(int i=0;i<N;i++) {
			s[i] = stdin.next();
		}
		for(int h=0;h<N;h++) {
			char[] copy = s[h].toCharArray();
			Arrays.sort(copy);
			s[h] = new String(copy);
		}
		Arrays.sort(s);

		for(int i=0;i<N-1;i++) {
			int j=i+1;
			long sin=1;
			while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			}
			cnt+=(sin*(sin-1))/2;
			i=j-1;
		}

		out.println(cnt);

		out.flush();
	}

	
} Main
import java.io.PrintWriter;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int N = Integer.parseInt(stdin.next());
		String s[] = new String[N];
		long cnt = 0;
		
		
		for(int i=0;i<N;i++) {
			s[i] = stdin.next();
		}
		for(int h=0;h<N;h++) {
			char[] copy = s[h].toCharArray();
			Arrays.sort(copy);
			s[h] = new String(copy);
		}
		Arrays.sort(s);

		for(int i=0;i<N-1;i++) {
			int j=i+1;
			long sin=1;
			while(s[i].equals(s[j])) {
					if(j!=N-1) {
						j+=1;
						sin+=1;
					}
					else {
						sin+=1;
						break;
					}
			}
			cnt+=(sin*(sin-1))/2;
			i=j-1;
		}

		out.println(cnt);

		out.flush();
	}

	
}