import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		
		char[][] moji = new char[n][10];
		
		for(int i = 0; i < n; i++) {
			moji[i] = stdIn.next().toCharArray();
			Arrays.sort(moji[i]);
		}
		
		
		String[] tmp = new String[n];
		
		for(int i = 0; i < n; i++) {
			tmp[i] = String.valueOf(moji[i]);
		}
		
		Arrays.sort(tmp);
		

		
		long ans = 0;
		
		long cnt = 1;
		for(int i = 0; i < n-1; i++) {
			if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			}
			
			
			
		}
		if(cnt != 1) {
			ans += cnt * (cnt-1)/2;
		}
		
		System.out.println(ans);
		
		
	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		
		char[][] moji = new char[n][10];
		
		for(int i = 0; i < n; i++) {
			moji[i] = stdIn.next().toCharArray();
			Arrays.sort(moji[i]);
		}
		
		
		String[] tmp = new String[n];
		
		for(int i = 0; i < n; i++) {
			tmp[i] = String.valueOf(moji[i]);
		}
		
		Arrays.sort(tmp);
		

		
		long ans = 0;
		
		long cnt = 1;
		for(int i = 0; i < n-1; i++) {
			if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			}
			
			
			
		}
		if(cnt != 1) {
			ans += cnt * (cnt-1)/2;
		}
		
		System.out.println(ans);
		
		
	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		
		char[][] moji = new char[n][10];
		
		for(int i = 0; i < n; i++) {
			moji[i] = stdIn.next().toCharArray();
			Arrays.sort(moji[i]);
		}
		
		
		String[] tmp = new String[n];
		
		for(int i = 0; i < n; i++) {
			tmp[i] = String.valueOf(moji[i]);
		}
		
		Arrays.sort(tmp);
		

		
		long ans = 0;
		
		long cnt = 1;
		for(int i = 0; i < n-1; i++) {
			if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			}
			
			
			
		}
		if(cnt != 1) {
			ans += cnt * (cnt-1)/2;
		}
		
		System.out.println(ans);
		
		
	} main {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		
		char[][] moji = new char[n][10];
		
		for(int i = 0; i < n; i++) {
			moji[i] = stdIn.next().toCharArray();
			Arrays.sort(moji[i]);
		}
		
		
		String[] tmp = new String[n];
		
		for(int i = 0; i < n; i++) {
			tmp[i] = String.valueOf(moji[i]);
		}
		
		Arrays.sort(tmp);
		

		
		long ans = 0;
		
		long cnt = 1;
		for(int i = 0; i < n-1; i++) {
			if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			}
			
			
			
		}
		if(cnt != 1) {
			ans += cnt * (cnt-1)/2;
		}
		
		System.out.println(ans);
		
		
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn char[][] moji = new char[n][10]; moji new char[n][10] n 10 for(int i = 0; i < n; i++) {
			moji[i] = stdIn.next().toCharArray();
			Arrays.sort(moji[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			moji[i] = stdIn.next().toCharArray();
			Arrays.sort(moji[i]);
		} {
			moji[i] = stdIn.next().toCharArray();
			Arrays.sort(moji[i]);
		} moji[i] = stdIn.next().toCharArray() moji[i] moji i stdIn.next().toCharArray() stdIn.next().toCharArray stdIn.next() stdIn.next stdIn Arrays.sort(moji[i]) Arrays.sort Arrays moji[i] moji i String[] tmp = new String[n]; tmp new String[n] n for(int i = 0; i < n; i++) {
			tmp[i] = String.valueOf(moji[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			tmp[i] = String.valueOf(moji[i]);
		} {
			tmp[i] = String.valueOf(moji[i]);
		} tmp[i] = String.valueOf(moji[i]) tmp[i] tmp i String.valueOf(moji[i]) String.valueOf String moji[i] moji i Arrays.sort(tmp) Arrays.sort Arrays tmp long ans = 0; ans 0 long cnt = 1; cnt 1 for(int i = 0; i < n-1; i++) {
			if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			}
			
			
			
		} int i = 0; int i = 0; i 0 i < n-1 i n-1 n 1 i++ i++ i {
			if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			}
			
			
			
		} {
			if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			}
			
			
			
		} if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			} tmp[i].equals(tmp[i+1]) tmp[i].equals tmp[i] tmp i tmp[i+1] tmp i+1 i 1 {
				cnt++;
			} cnt++ cnt {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			} ans += cnt*(cnt-1)/2 ans cnt*(cnt-1)/2 cnt*(cnt-1) cnt (cnt-1) cnt 1 2 cnt = 1 cnt 1 if(cnt != 1) {
			ans += cnt * (cnt-1)/2;
		} cnt != 1 cnt 1 {
			ans += cnt * (cnt-1)/2;
		} ans += cnt * (cnt-1)/2 ans cnt * (cnt-1)/2 cnt * (cnt-1) cnt (cnt-1) cnt 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 stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		
		char[][] moji = new char[n][10];
		
		for(int i = 0; i < n; i++) {
			moji[i] = stdIn.next().toCharArray();
			Arrays.sort(moji[i]);
		}
		
		
		String[] tmp = new String[n];
		
		for(int i = 0; i < n; i++) {
			tmp[i] = String.valueOf(moji[i]);
		}
		
		Arrays.sort(tmp);
		

		
		long ans = 0;
		
		long cnt = 1;
		for(int i = 0; i < n-1; i++) {
			if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			}
			
			
			
		}
		if(cnt != 1) {
			ans += cnt * (cnt-1)/2;
		}
		
		System.out.println(ans);
		
		
	}

} public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		
		char[][] moji = new char[n][10];
		
		for(int i = 0; i < n; i++) {
			moji[i] = stdIn.next().toCharArray();
			Arrays.sort(moji[i]);
		}
		
		
		String[] tmp = new String[n];
		
		for(int i = 0; i < n; i++) {
			tmp[i] = String.valueOf(moji[i]);
		}
		
		Arrays.sort(tmp);
		

		
		long ans = 0;
		
		long cnt = 1;
		for(int i = 0; i < n-1; i++) {
			if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			}
			
			
			
		}
		if(cnt != 1) {
			ans += cnt * (cnt-1)/2;
		}
		
		System.out.println(ans);
		
		
	}

} Main
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		
		char[][] moji = new char[n][10];
		
		for(int i = 0; i < n; i++) {
			moji[i] = stdIn.next().toCharArray();
			Arrays.sort(moji[i]);
		}
		
		
		String[] tmp = new String[n];
		
		for(int i = 0; i < n; i++) {
			tmp[i] = String.valueOf(moji[i]);
		}
		
		Arrays.sort(tmp);
		

		
		long ans = 0;
		
		long cnt = 1;
		for(int i = 0; i < n-1; i++) {
			if(tmp[i].equals(tmp[i+1])) {
				cnt++;
			}else {
				ans += cnt*(cnt-1)/2;
				cnt = 1;
			}
			
			
			
		}
		if(cnt != 1) {
			ans += cnt * (cnt-1)/2;
		}
		
		System.out.println(ans);
		
		
	}

}