import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int N = nextInt();
		//int Slen = 10;

		char[][] C = new char[N][10];
		String[] S = new String [N];
		boolean[] f = new boolean [N];//比較済みであり

		for(int i=0;i<N;i++) {
			C[i]=next().toCharArray();
			Arrays.sort(C[i]);
			S[i] = new String(C[i]);
		}
		Arrays.sort(S);

		long sum = 0;
		for(int i=0;i<N-1;i++) {
			if(f[i])continue; // 加算済みであれば次へ飛ばす
			long cnt = 0;
			for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			}
			while(cnt>0) {
				sum+=cnt;
				cnt--;
			}
		}
		out.println(sum);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

} import java.io.PrintStream; PrintStream java.io import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int N = nextInt();
		//int Slen = 10;

		char[][] C = new char[N][10];
		String[] S = new String [N];
		boolean[] f = new boolean [N];//比較済みであり

		for(int i=0;i<N;i++) {
			C[i]=next().toCharArray();
			Arrays.sort(C[i]);
			S[i] = new String(C[i]);
		}
		Arrays.sort(S);

		long sum = 0;
		for(int i=0;i<N-1;i++) {
			if(f[i])continue; // 加算済みであれば次へ飛ばす
			long cnt = 0;
			for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			}
			while(cnt>0) {
				sum+=cnt;
				cnt--;
			}
		}
		out.println(sum);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

} Main static final PrintStream out = System.out; out System.out System System.out static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static final long Mod = 1000_000_007L; Mod 1000_000_007L public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	} main {
		Main main = new Main();
		main.solve();
		System.exit(0);
	} Main main = new Main(); main new Main() main.solve() main.solve main System.exit(0) System.exit System 0 String[] args args void solve() {
		int N = nextInt();
		//int Slen = 10;

		char[][] C = new char[N][10];
		String[] S = new String [N];
		boolean[] f = new boolean [N];//比較済みであり

		for(int i=0;i<N;i++) {
			C[i]=next().toCharArray();
			Arrays.sort(C[i]);
			S[i] = new String(C[i]);
		}
		Arrays.sort(S);

		long sum = 0;
		for(int i=0;i<N-1;i++) {
			if(f[i])continue; // 加算済みであれば次へ飛ばす
			long cnt = 0;
			for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			}
			while(cnt>0) {
				sum+=cnt;
				cnt--;
			}
		}
		out.println(sum);
	} solve {
		int N = nextInt();
		//int Slen = 10;

		char[][] C = new char[N][10];
		String[] S = new String [N];
		boolean[] f = new boolean [N];//比較済みであり

		for(int i=0;i<N;i++) {
			C[i]=next().toCharArray();
			Arrays.sort(C[i]);
			S[i] = new String(C[i]);
		}
		Arrays.sort(S);

		long sum = 0;
		for(int i=0;i<N-1;i++) {
			if(f[i])continue; // 加算済みであれば次へ飛ばす
			long cnt = 0;
			for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			}
			while(cnt>0) {
				sum+=cnt;
				cnt--;
			}
		}
		out.println(sum);
	} int N = nextInt(); N nextInt() nextInt char[][] C = new char[N][10]; C new char[N][10] N 10 String[] S = new String [N]; S new String [N] N boolean[] f = new boolean [N]; f new boolean [N] N for(int i=0;i<N;i++) {
			C[i]=next().toCharArray();
			Arrays.sort(C[i]);
			S[i] = new String(C[i]);
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			C[i]=next().toCharArray();
			Arrays.sort(C[i]);
			S[i] = new String(C[i]);
		} {
			C[i]=next().toCharArray();
			Arrays.sort(C[i]);
			S[i] = new String(C[i]);
		} C[i]=next().toCharArray() C[i] C i next().toCharArray() next().toCharArray next() next Arrays.sort(C[i]) Arrays.sort Arrays C[i] C i S[i] = new String(C[i]) S[i] S i new String(C[i]) Arrays.sort(S) Arrays.sort Arrays S long sum = 0; sum 0 for(int i=0;i<N-1;i++) {
			if(f[i])continue; // 加算済みであれば次へ飛ばす
			long cnt = 0;
			for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			}
			while(cnt>0) {
				sum+=cnt;
				cnt--;
			}
		} int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
			if(f[i])continue; // 加算済みであれば次へ飛ばす
			long cnt = 0;
			for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			}
			while(cnt>0) {
				sum+=cnt;
				cnt--;
			}
		} {
			if(f[i])continue; // 加算済みであれば次へ飛ばす
			long cnt = 0;
			for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			}
			while(cnt>0) {
				sum+=cnt;
				cnt--;
			}
		} if(f[i])continue; // 加算済みであれば次へ飛ばす f[i] f i continue; // 加算済みであれば次へ飛ばす long cnt = 0; cnt 0 for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			} int j=i+1; int j=i+1; j i+1 i 1 j<N j N j++ j++ j {
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			} {
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			} if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				} S[i].equals(S[j]) S[i].equals S[i] S i S[j] S j {
					cnt++;
					f[j] = true;
				} cnt++ cnt f[j] = true f[j] f j true {
					break;
				} break; while(cnt>0) {
				sum+=cnt;
				cnt--;
			} cnt>0 cnt 0 {
				sum+=cnt;
				cnt--;
			} sum+=cnt sum cnt cnt-- cnt out.println(sum) out.println out sum public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	} nextIntArray {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	} int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++)a[i] = nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = nextInt(); a[i] = nextInt() a[i] a i nextInt() nextInt return a; a int n n public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	} nextLongArray {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	} long[] a = new long[n]; a new long[n] n for (int i = 0; i < n; i++)a[i] = nextLong(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = nextLong(); a[i] = nextLong() a[i] a i nextLong() nextLong return a; a int n n public int nextInt() {
		return Integer.parseInt(next());
	} nextInt {
		return Integer.parseInt(next());
	} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() {
		return Long.parseLong(next());
	} nextLong {
		return Long.parseLong(next());
	} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public String next() {
		return sc.next();
	} next {
		return sc.next();
	} return sc.next(); sc.next() sc.next sc public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int N = nextInt();
		//int Slen = 10;

		char[][] C = new char[N][10];
		String[] S = new String [N];
		boolean[] f = new boolean [N];//比較済みであり

		for(int i=0;i<N;i++) {
			C[i]=next().toCharArray();
			Arrays.sort(C[i]);
			S[i] = new String(C[i]);
		}
		Arrays.sort(S);

		long sum = 0;
		for(int i=0;i<N-1;i++) {
			if(f[i])continue; // 加算済みであれば次へ飛ばす
			long cnt = 0;
			for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			}
			while(cnt>0) {
				sum+=cnt;
				cnt--;
			}
		}
		out.println(sum);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

} public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int N = nextInt();
		//int Slen = 10;

		char[][] C = new char[N][10];
		String[] S = new String [N];
		boolean[] f = new boolean [N];//比較済みであり

		for(int i=0;i<N;i++) {
			C[i]=next().toCharArray();
			Arrays.sort(C[i]);
			S[i] = new String(C[i]);
		}
		Arrays.sort(S);

		long sum = 0;
		for(int i=0;i<N-1;i++) {
			if(f[i])continue; // 加算済みであれば次へ飛ばす
			long cnt = 0;
			for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			}
			while(cnt>0) {
				sum+=cnt;
				cnt--;
			}
		}
		out.println(sum);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

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

public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int N = nextInt();
		//int Slen = 10;

		char[][] C = new char[N][10];
		String[] S = new String [N];
		boolean[] f = new boolean [N];//比較済みであり

		for(int i=0;i<N;i++) {
			C[i]=next().toCharArray();
			Arrays.sort(C[i]);
			S[i] = new String(C[i]);
		}
		Arrays.sort(S);

		long sum = 0;
		for(int i=0;i<N-1;i++) {
			if(f[i])continue; // 加算済みであれば次へ飛ばす
			long cnt = 0;
			for(int j=i+1;j<N;j++){
				if(S[i].equals(S[j])) {
					cnt++;
					f[j] = true;
				}else {
					break;
				}
			}
			while(cnt>0) {
				sum+=cnt;
				cnt--;
			}
		}
		out.println(sum);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

}