import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String nn = stdIn.next();
		int n = Integer.parseInt(nn); //n個の文字列
		char[][] s = new char[n][10];
		String[] moji = new String[n];

		for(int i = 0; i < n; i++) {
			s[i] = stdIn.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i = 0; i < n; i++) {
			moji[i] = String.valueOf(s[i]);
		}
		
		Arrays.sort(moji);

		long cnt = 0;
		long shikoi = 0;
		for(int i = 0; i < n-1; i++) {
			if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			}
		}
		System.out.println(cnt);

	}

} 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);
		String nn = stdIn.next();
		int n = Integer.parseInt(nn); //n個の文字列
		char[][] s = new char[n][10];
		String[] moji = new String[n];

		for(int i = 0; i < n; i++) {
			s[i] = stdIn.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i = 0; i < n; i++) {
			moji[i] = String.valueOf(s[i]);
		}
		
		Arrays.sort(moji);

		long cnt = 0;
		long shikoi = 0;
		for(int i = 0; i < n-1; i++) {
			if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			}
		}
		System.out.println(cnt);

	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String nn = stdIn.next();
		int n = Integer.parseInt(nn); //n個の文字列
		char[][] s = new char[n][10];
		String[] moji = new String[n];

		for(int i = 0; i < n; i++) {
			s[i] = stdIn.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i = 0; i < n; i++) {
			moji[i] = String.valueOf(s[i]);
		}
		
		Arrays.sort(moji);

		long cnt = 0;
		long shikoi = 0;
		for(int i = 0; i < n-1; i++) {
			if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			}
		}
		System.out.println(cnt);

	} main {
		Scanner stdIn = new Scanner(System.in);
		String nn = stdIn.next();
		int n = Integer.parseInt(nn); //n個の文字列
		char[][] s = new char[n][10];
		String[] moji = new String[n];

		for(int i = 0; i < n; i++) {
			s[i] = stdIn.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i = 0; i < n; i++) {
			moji[i] = String.valueOf(s[i]);
		}
		
		Arrays.sort(moji);

		long cnt = 0;
		long shikoi = 0;
		for(int i = 0; i < n-1; i++) {
			if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			}
		}
		System.out.println(cnt);

	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String nn = stdIn.next(); nn stdIn.next() stdIn.next stdIn int n = Integer.parseInt(nn); n Integer.parseInt(nn) Integer.parseInt Integer nn char[][] s = new char[n][10]; s new char[n][10] n 10 String[] moji = new String[n]; moji new String[n] n for(int i = 0; i < n; i++) {
			s[i] = stdIn.next().toCharArray();
			Arrays.sort(s[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			s[i] = stdIn.next().toCharArray();
			Arrays.sort(s[i]);
		} {
			s[i] = stdIn.next().toCharArray();
			Arrays.sort(s[i]);
		} s[i] = stdIn.next().toCharArray() s[i] s i stdIn.next().toCharArray() stdIn.next().toCharArray stdIn.next() stdIn.next stdIn Arrays.sort(s[i]) Arrays.sort Arrays s[i] s i for(int i = 0; i < n; i++) {
			moji[i] = String.valueOf(s[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			moji[i] = String.valueOf(s[i]);
		} {
			moji[i] = String.valueOf(s[i]);
		} moji[i] = String.valueOf(s[i]) moji[i] moji i String.valueOf(s[i]) String.valueOf String s[i] s i Arrays.sort(moji) Arrays.sort Arrays moji long cnt = 0; cnt 0 long shikoi = 0; shikoi 0 for(int i = 0; i < n-1; i++) {
			if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			}
		} int i = 0; int i = 0; i 0 i < n-1 i n-1 n 1 i++ i++ i {
			if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			}
		} {
			if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			}
		} if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			} moji[i].equals(moji[i+1]) moji[i].equals moji[i] moji i moji[i+1] moji i+1 i 1 {
				shikoi++;
				cnt += shikoi;
			} shikoi++ shikoi cnt += shikoi cnt shikoi {
				shikoi = 0;
			} shikoi = 0 shikoi 0 System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String nn = stdIn.next();
		int n = Integer.parseInt(nn); //n個の文字列
		char[][] s = new char[n][10];
		String[] moji = new String[n];

		for(int i = 0; i < n; i++) {
			s[i] = stdIn.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i = 0; i < n; i++) {
			moji[i] = String.valueOf(s[i]);
		}
		
		Arrays.sort(moji);

		long cnt = 0;
		long shikoi = 0;
		for(int i = 0; i < n-1; i++) {
			if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			}
		}
		System.out.println(cnt);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String nn = stdIn.next();
		int n = Integer.parseInt(nn); //n個の文字列
		char[][] s = new char[n][10];
		String[] moji = new String[n];

		for(int i = 0; i < n; i++) {
			s[i] = stdIn.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i = 0; i < n; i++) {
			moji[i] = String.valueOf(s[i]);
		}
		
		Arrays.sort(moji);

		long cnt = 0;
		long shikoi = 0;
		for(int i = 0; i < n-1; i++) {
			if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			}
		}
		System.out.println(cnt);

	}

} Main
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String nn = stdIn.next();
		int n = Integer.parseInt(nn); //n個の文字列
		char[][] s = new char[n][10];
		String[] moji = new String[n];

		for(int i = 0; i < n; i++) {
			s[i] = stdIn.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i = 0; i < n; i++) {
			moji[i] = String.valueOf(s[i]);
		}
		
		Arrays.sort(moji);

		long cnt = 0;
		long shikoi = 0;
		for(int i = 0; i < n-1; i++) {
			if(moji[i].equals(moji[i+1])) {
				shikoi++;
				cnt += shikoi;
			}else {
				shikoi = 0;
			}
		}
		System.out.println(cnt);

	}

}
