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

public class Main {

	public static void main(String[] args) {

		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		sc.nextLine();
		String[] sArray = new String[n];
		for(int i = 0 ; i < n ; i++) {
			String tmp = sc.nextLine();
			char[] ch = tmp.toCharArray();
			Arrays.sort(ch);
			sArray[i] = new String(ch);
			ch = null;
			tmp = null;
		}
		Arrays.sort(sArray);
		long cnt = 0;
		long cat = 1;
		String pre = null;
		for(String s : sArray) {
			if(pre == null) {
				pre = s;
				continue;
			}
			if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			}
			pre = s;
		}
		cnt += count(cat);
		System.out.println(cnt);
		sc.close();

	}

	private static long count(long n) {
		long ret = 0;
		for(long i = 1 ; i <= n ; i++) {
			ret += (n - i);
		}
		return ret;
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		sc.nextLine();
		String[] sArray = new String[n];
		for(int i = 0 ; i < n ; i++) {
			String tmp = sc.nextLine();
			char[] ch = tmp.toCharArray();
			Arrays.sort(ch);
			sArray[i] = new String(ch);
			ch = null;
			tmp = null;
		}
		Arrays.sort(sArray);
		long cnt = 0;
		long cat = 1;
		String pre = null;
		for(String s : sArray) {
			if(pre == null) {
				pre = s;
				continue;
			}
			if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			}
			pre = s;
		}
		cnt += count(cat);
		System.out.println(cnt);
		sc.close();

	}

	private static long count(long n) {
		long ret = 0;
		for(long i = 1 ; i <= n ; i++) {
			ret += (n - i);
		}
		return ret;
	}
} Main public static void main(String[] args) {

		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		sc.nextLine();
		String[] sArray = new String[n];
		for(int i = 0 ; i < n ; i++) {
			String tmp = sc.nextLine();
			char[] ch = tmp.toCharArray();
			Arrays.sort(ch);
			sArray[i] = new String(ch);
			ch = null;
			tmp = null;
		}
		Arrays.sort(sArray);
		long cnt = 0;
		long cat = 1;
		String pre = null;
		for(String s : sArray) {
			if(pre == null) {
				pre = s;
				continue;
			}
			if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			}
			pre = s;
		}
		cnt += count(cat);
		System.out.println(cnt);
		sc.close();

	} main {

		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		sc.nextLine();
		String[] sArray = new String[n];
		for(int i = 0 ; i < n ; i++) {
			String tmp = sc.nextLine();
			char[] ch = tmp.toCharArray();
			Arrays.sort(ch);
			sArray[i] = new String(ch);
			ch = null;
			tmp = null;
		}
		Arrays.sort(sArray);
		long cnt = 0;
		long cat = 1;
		String pre = null;
		for(String s : sArray) {
			if(pre == null) {
				pre = s;
				continue;
			}
			if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			}
			pre = s;
		}
		cnt += count(cat);
		System.out.println(cnt);
		sc.close();

	} int n; n Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc String[] sArray = new String[n]; sArray new String[n] n for(int i = 0 ; i < n ; i++) {
			String tmp = sc.nextLine();
			char[] ch = tmp.toCharArray();
			Arrays.sort(ch);
			sArray[i] = new String(ch);
			ch = null;
			tmp = null;
		} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
			String tmp = sc.nextLine();
			char[] ch = tmp.toCharArray();
			Arrays.sort(ch);
			sArray[i] = new String(ch);
			ch = null;
			tmp = null;
		} {
			String tmp = sc.nextLine();
			char[] ch = tmp.toCharArray();
			Arrays.sort(ch);
			sArray[i] = new String(ch);
			ch = null;
			tmp = null;
		} String tmp = sc.nextLine(); tmp sc.nextLine() sc.nextLine sc char[] ch = tmp.toCharArray(); ch tmp.toCharArray() tmp.toCharArray tmp Arrays.sort(ch) Arrays.sort Arrays ch sArray[i] = new String(ch) sArray[i] sArray i new String(ch) ch = null ch null tmp = null tmp null Arrays.sort(sArray) Arrays.sort Arrays sArray long cnt = 0; cnt 0 long cat = 1; cat 1 String pre = null; pre null for(String s : sArray) {
			if(pre == null) {
				pre = s;
				continue;
			}
			if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			}
			pre = s;
		} String s sArray {
			if(pre == null) {
				pre = s;
				continue;
			}
			if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			}
			pre = s;
		} {
			if(pre == null) {
				pre = s;
				continue;
			}
			if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			}
			pre = s;
		} if(pre == null) {
				pre = s;
				continue;
			} pre == null pre null {
				pre = s;
				continue;
			} pre = s pre s continue; if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			} !pre.equals(s) pre.equals(s) pre.equals pre s {
				cnt += count(cat);
				cat = 1;
			} cnt += count(cat) cnt count(cat) count cat cat = 1 cat 1 {
				cat++;
			} cat++ cat pre = s pre s cnt += count(cat) cnt count(cat) count cat System.out.println(cnt) System.out.println System.out System System.out cnt sc.close() sc.close sc String[] args args private static long count(long n) {
		long ret = 0;
		for(long i = 1 ; i <= n ; i++) {
			ret += (n - i);
		}
		return ret;
	} count {
		long ret = 0;
		for(long i = 1 ; i <= n ; i++) {
			ret += (n - i);
		}
		return ret;
	} long ret = 0; ret 0 for(long i = 1 ; i <= n ; i++) {
			ret += (n - i);
		} long i = 1 ; long i = 1 ; i 1 i <= n i n i++ i++ i {
			ret += (n - i);
		} {
			ret += (n - i);
		} ret += (n - i) ret (n - i) n i return ret; ret long n n public class Main {

	public static void main(String[] args) {

		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		sc.nextLine();
		String[] sArray = new String[n];
		for(int i = 0 ; i < n ; i++) {
			String tmp = sc.nextLine();
			char[] ch = tmp.toCharArray();
			Arrays.sort(ch);
			sArray[i] = new String(ch);
			ch = null;
			tmp = null;
		}
		Arrays.sort(sArray);
		long cnt = 0;
		long cat = 1;
		String pre = null;
		for(String s : sArray) {
			if(pre == null) {
				pre = s;
				continue;
			}
			if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			}
			pre = s;
		}
		cnt += count(cat);
		System.out.println(cnt);
		sc.close();

	}

	private static long count(long n) {
		long ret = 0;
		for(long i = 1 ; i <= n ; i++) {
			ret += (n - i);
		}
		return ret;
	}
} public class Main {

	public static void main(String[] args) {

		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		sc.nextLine();
		String[] sArray = new String[n];
		for(int i = 0 ; i < n ; i++) {
			String tmp = sc.nextLine();
			char[] ch = tmp.toCharArray();
			Arrays.sort(ch);
			sArray[i] = new String(ch);
			ch = null;
			tmp = null;
		}
		Arrays.sort(sArray);
		long cnt = 0;
		long cat = 1;
		String pre = null;
		for(String s : sArray) {
			if(pre == null) {
				pre = s;
				continue;
			}
			if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			}
			pre = s;
		}
		cnt += count(cat);
		System.out.println(cnt);
		sc.close();

	}

	private static long count(long n) {
		long ret = 0;
		for(long i = 1 ; i <= n ; i++) {
			ret += (n - i);
		}
		return ret;
	}
} Main

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

public class Main {

	public static void main(String[] args) {

		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		sc.nextLine();
		String[] sArray = new String[n];
		for(int i = 0 ; i < n ; i++) {
			String tmp = sc.nextLine();
			char[] ch = tmp.toCharArray();
			Arrays.sort(ch);
			sArray[i] = new String(ch);
			ch = null;
			tmp = null;
		}
		Arrays.sort(sArray);
		long cnt = 0;
		long cat = 1;
		String pre = null;
		for(String s : sArray) {
			if(pre == null) {
				pre = s;
				continue;
			}
			if(!pre.equals(s)) {
				cnt += count(cat);
				cat = 1;
			} else {
				cat++;
			}
			pre = s;
		}
		cnt += count(cat);
		System.out.println(cnt);
		sc.close();

	}

	private static long count(long n) {
		long ret = 0;
		for(long i = 1 ; i <= n ; i++) {
			ret += (n - i);
		}
		return ret;
	}
}
