import java.util.*;

public class Main {

	public static long calc(long cnt) {
		if (cnt <= 1)
			return 0;
		long ans = 0;
		if (cnt % 2 == 0) {
			ans = cnt / 2;
			ans *= (cnt - 1);
		} else {
			ans = (cnt - 1) / 2;
			ans *= cnt;
		}
		return ans;
	}

	public static String mysort(String s) {
		char c[] = s.toCharArray();
		Arrays.sort(c);
		String ans = new String(c);
		return ans;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long cnt = 0, ans = 0;
		String s[] = new String[n];
		for (int i = 0; i < n; ++i) {
			s[i] = sc.next();
			String tm = mysort(s[i]);
			s[i] = tm;
		}
		sc.close();
		Arrays.sort(s);
		String t = s[0];
		for (int i = 0; i < n; ++i) {
			if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			}
		}
		ans += calc(cnt);
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {

	public static long calc(long cnt) {
		if (cnt <= 1)
			return 0;
		long ans = 0;
		if (cnt % 2 == 0) {
			ans = cnt / 2;
			ans *= (cnt - 1);
		} else {
			ans = (cnt - 1) / 2;
			ans *= cnt;
		}
		return ans;
	}

	public static String mysort(String s) {
		char c[] = s.toCharArray();
		Arrays.sort(c);
		String ans = new String(c);
		return ans;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long cnt = 0, ans = 0;
		String s[] = new String[n];
		for (int i = 0; i < n; ++i) {
			s[i] = sc.next();
			String tm = mysort(s[i]);
			s[i] = tm;
		}
		sc.close();
		Arrays.sort(s);
		String t = s[0];
		for (int i = 0; i < n; ++i) {
			if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			}
		}
		ans += calc(cnt);
		System.out.println(ans);
	}
} Main public static long calc(long cnt) {
		if (cnt <= 1)
			return 0;
		long ans = 0;
		if (cnt % 2 == 0) {
			ans = cnt / 2;
			ans *= (cnt - 1);
		} else {
			ans = (cnt - 1) / 2;
			ans *= cnt;
		}
		return ans;
	} calc {
		if (cnt <= 1)
			return 0;
		long ans = 0;
		if (cnt % 2 == 0) {
			ans = cnt / 2;
			ans *= (cnt - 1);
		} else {
			ans = (cnt - 1) / 2;
			ans *= cnt;
		}
		return ans;
	} if (cnt <= 1)
			return 0; cnt <= 1 cnt 1 return 0; 0 long ans = 0; ans 0 if (cnt % 2 == 0) {
			ans = cnt / 2;
			ans *= (cnt - 1);
		} else {
			ans = (cnt - 1) / 2;
			ans *= cnt;
		} cnt % 2 == 0 cnt % 2 cnt 2 0 {
			ans = cnt / 2;
			ans *= (cnt - 1);
		} ans = cnt / 2 ans cnt / 2 cnt 2 ans *= (cnt - 1) ans (cnt - 1) cnt 1 {
			ans = (cnt - 1) / 2;
			ans *= cnt;
		} ans = (cnt - 1) / 2 ans (cnt - 1) / 2 (cnt - 1) cnt 1 2 ans *= cnt ans cnt return ans; ans long cnt cnt public static String mysort(String s) {
		char c[] = s.toCharArray();
		Arrays.sort(c);
		String ans = new String(c);
		return ans;
	} mysort {
		char c[] = s.toCharArray();
		Arrays.sort(c);
		String ans = new String(c);
		return ans;
	} char c[] = s.toCharArray(); c s.toCharArray() s.toCharArray s Arrays.sort(c) Arrays.sort Arrays c String ans = new String(c); ans new String(c) return ans; ans String s s public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long cnt = 0, ans = 0;
		String s[] = new String[n];
		for (int i = 0; i < n; ++i) {
			s[i] = sc.next();
			String tm = mysort(s[i]);
			s[i] = tm;
		}
		sc.close();
		Arrays.sort(s);
		String t = s[0];
		for (int i = 0; i < n; ++i) {
			if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			}
		}
		ans += calc(cnt);
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long cnt = 0, ans = 0;
		String s[] = new String[n];
		for (int i = 0; i < n; ++i) {
			s[i] = sc.next();
			String tm = mysort(s[i]);
			s[i] = tm;
		}
		sc.close();
		Arrays.sort(s);
		String t = s[0];
		for (int i = 0; i < n; ++i) {
			if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			}
		}
		ans += calc(cnt);
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long cnt = 0 cnt 0 ans = 0; ans 0 String s[] = new String[n]; s new String[n] n for (int i = 0; i < n; ++i) {
			s[i] = sc.next();
			String tm = mysort(s[i]);
			s[i] = tm;
		} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
			s[i] = sc.next();
			String tm = mysort(s[i]);
			s[i] = tm;
		} {
			s[i] = sc.next();
			String tm = mysort(s[i]);
			s[i] = tm;
		} s[i] = sc.next() s[i] s i sc.next() sc.next sc String tm = mysort(s[i]); tm mysort(s[i]) mysort s[i] s i s[i] = tm s[i] s i tm sc.close() sc.close sc Arrays.sort(s) Arrays.sort Arrays s String t = s[0]; t s[0] s 0 for (int i = 0; i < n; ++i) {
			if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			}
		} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
			if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			}
		} {
			if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			}
		} if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			} t.equals(s[i]) t.equals t s[i] s i ++cnt cnt {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			} t = s[i] t s[i] s i ans += calc(cnt) ans calc(cnt) calc cnt cnt = 1 cnt 1 ans += calc(cnt) ans calc(cnt) calc cnt System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static long calc(long cnt) {
		if (cnt <= 1)
			return 0;
		long ans = 0;
		if (cnt % 2 == 0) {
			ans = cnt / 2;
			ans *= (cnt - 1);
		} else {
			ans = (cnt - 1) / 2;
			ans *= cnt;
		}
		return ans;
	}

	public static String mysort(String s) {
		char c[] = s.toCharArray();
		Arrays.sort(c);
		String ans = new String(c);
		return ans;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long cnt = 0, ans = 0;
		String s[] = new String[n];
		for (int i = 0; i < n; ++i) {
			s[i] = sc.next();
			String tm = mysort(s[i]);
			s[i] = tm;
		}
		sc.close();
		Arrays.sort(s);
		String t = s[0];
		for (int i = 0; i < n; ++i) {
			if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			}
		}
		ans += calc(cnt);
		System.out.println(ans);
	}
} public class Main {

	public static long calc(long cnt) {
		if (cnt <= 1)
			return 0;
		long ans = 0;
		if (cnt % 2 == 0) {
			ans = cnt / 2;
			ans *= (cnt - 1);
		} else {
			ans = (cnt - 1) / 2;
			ans *= cnt;
		}
		return ans;
	}

	public static String mysort(String s) {
		char c[] = s.toCharArray();
		Arrays.sort(c);
		String ans = new String(c);
		return ans;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long cnt = 0, ans = 0;
		String s[] = new String[n];
		for (int i = 0; i < n; ++i) {
			s[i] = sc.next();
			String tm = mysort(s[i]);
			s[i] = tm;
		}
		sc.close();
		Arrays.sort(s);
		String t = s[0];
		for (int i = 0; i < n; ++i) {
			if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			}
		}
		ans += calc(cnt);
		System.out.println(ans);
	}
} Main
import java.util.*;

public class Main {

	public static long calc(long cnt) {
		if (cnt <= 1)
			return 0;
		long ans = 0;
		if (cnt % 2 == 0) {
			ans = cnt / 2;
			ans *= (cnt - 1);
		} else {
			ans = (cnt - 1) / 2;
			ans *= cnt;
		}
		return ans;
	}

	public static String mysort(String s) {
		char c[] = s.toCharArray();
		Arrays.sort(c);
		String ans = new String(c);
		return ans;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long cnt = 0, ans = 0;
		String s[] = new String[n];
		for (int i = 0; i < n; ++i) {
			s[i] = sc.next();
			String tm = mysort(s[i]);
			s[i] = tm;
		}
		sc.close();
		Arrays.sort(s);
		String t = s[0];
		for (int i = 0; i < n; ++i) {
			if (t.equals(s[i]))
				++cnt;
			else {
				t = s[i];
				ans += calc(cnt);
				cnt = 1;
			}
		}
		ans += calc(cnt);
		System.out.println(ans);
	}
}
