import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<>();
        for(int i = 0; i  < n; i++) {
        	String s = normalize(sc.next());
        	list.add(s);
        }

        list.add("zzzzzzzzzzzzzzzzzz");//dummy
        Collections.sort(list);

        long ans = 0;
        for(int i = 0; i < list.size(); i++) {
        	for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	}
        }
        System.out.println(ans);
	}

	public static long comb(long num) {
		return num * (num-1) / 2;
	}

	public static String normalize(String s) {
		int [] num = new int [26];
		for(int i = 0; i < s.length(); i++) {
			int ch = s.charAt(i) - 'a';
			num[ch]++;
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < 26; i++) {
			char c = (char)('a' + i);
			for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			}
		}
		return sb.toString();
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<>();
        for(int i = 0; i  < n; i++) {
        	String s = normalize(sc.next());
        	list.add(s);
        }

        list.add("zzzzzzzzzzzzzzzzzz");//dummy
        Collections.sort(list);

        long ans = 0;
        for(int i = 0; i < list.size(); i++) {
        	for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	}
        }
        System.out.println(ans);
	}

	public static long comb(long num) {
		return num * (num-1) / 2;
	}

	public static String normalize(String s) {
		int [] num = new int [26];
		for(int i = 0; i < s.length(); i++) {
			int ch = s.charAt(i) - 'a';
			num[ch]++;
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < 26; i++) {
			char c = (char)('a' + i);
			for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			}
		}
		return sb.toString();
	}
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<>();
        for(int i = 0; i  < n; i++) {
        	String s = normalize(sc.next());
        	list.add(s);
        }

        list.add("zzzzzzzzzzzzzzzzzz");//dummy
        Collections.sort(list);

        long ans = 0;
        for(int i = 0; i < list.size(); i++) {
        	for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	}
        }
        System.out.println(ans);
	} main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<>();
        for(int i = 0; i  < n; i++) {
        	String s = normalize(sc.next());
        	list.add(s);
        }

        list.add("zzzzzzzzzzzzzzzzzz");//dummy
        Collections.sort(list);

        long ans = 0;
        for(int i = 0; i < list.size(); i++) {
        	for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	}
        }
        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 List<String> list = new ArrayList<>(); list new ArrayList<>() for(int i = 0; i  < n; i++) {
        	String s = normalize(sc.next());
        	list.add(s);
        } int i = 0; int i = 0; i 0 i  < n i n i++ i++ i {
        	String s = normalize(sc.next());
        	list.add(s);
        } {
        	String s = normalize(sc.next());
        	list.add(s);
        } String s = normalize(sc.next()); s normalize(sc.next()) normalize sc.next() sc.next sc list.add(s) list.add list s list.add("zzzzzzzzzzzzzzzzzz") list.add list "zzzzzzzzzzzzzzzzzz" Collections.sort(list) Collections.sort Collections list long ans = 0; ans 0 for(int i = 0; i < list.size(); i++) {
        	for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	}
        } int i = 0; int i = 0; i 0 i < list.size() i list.size() list.size list i++ i++ i {
        	for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	}
        } {
        	for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	}
        } for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	} int j = i + 1 ; int j = i + 1 ; j i + 1 i 1 j < list.size() j list.size() list.size list j++ j++ j {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	} {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	} if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		} ! list.get(i).equals(list.get(j)) list.get(i).equals(list.get(j)) list.get(i).equals list.get(i) list.get list i list.get(j) list.get list j {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		} ans += (comb(j - i)) ans (comb(j - i)) comb j - i j i i = j -1 i j -1 j 1 break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static long comb(long num) {
		return num * (num-1) / 2;
	} comb {
		return num * (num-1) / 2;
	} return num * (num-1) / 2; num * (num-1) / 2 num * (num-1) num (num-1) num 1 2 long num num public static String normalize(String s) {
		int [] num = new int [26];
		for(int i = 0; i < s.length(); i++) {
			int ch = s.charAt(i) - 'a';
			num[ch]++;
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < 26; i++) {
			char c = (char)('a' + i);
			for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			}
		}
		return sb.toString();
	} normalize {
		int [] num = new int [26];
		for(int i = 0; i < s.length(); i++) {
			int ch = s.charAt(i) - 'a';
			num[ch]++;
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < 26; i++) {
			char c = (char)('a' + i);
			for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			}
		}
		return sb.toString();
	} int [] num = new int [26]; num new int [26] 26 for(int i = 0; i < s.length(); i++) {
			int ch = s.charAt(i) - 'a';
			num[ch]++;
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			int ch = s.charAt(i) - 'a';
			num[ch]++;
		} {
			int ch = s.charAt(i) - 'a';
			num[ch]++;
		} int ch = s.charAt(i) - 'a'; ch s.charAt(i) - 'a' s.charAt(i) s.charAt s i 'a' num[ch]++ num[ch] num ch StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0; i < 26; i++) {
			char c = (char)('a' + i);
			for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			}
		} int i = 0; int i = 0; i 0 i < 26 i 26 i++ i++ i {
			char c = (char)('a' + i);
			for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			}
		} {
			char c = (char)('a' + i);
			for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			}
		} char c = (char)('a' + i); c (char)('a' + i) 'a' i for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			} int j = 0; int j = 0; j 0 j < num[i] j num[i] num i j++ j++ j {
				sb.append(c);
			} {
				sb.append(c);
			} sb.append(c) sb.append sb c return sb.toString(); sb.toString() sb.toString sb String s s public class Main {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<>();
        for(int i = 0; i  < n; i++) {
        	String s = normalize(sc.next());
        	list.add(s);
        }

        list.add("zzzzzzzzzzzzzzzzzz");//dummy
        Collections.sort(list);

        long ans = 0;
        for(int i = 0; i < list.size(); i++) {
        	for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	}
        }
        System.out.println(ans);
	}

	public static long comb(long num) {
		return num * (num-1) / 2;
	}

	public static String normalize(String s) {
		int [] num = new int [26];
		for(int i = 0; i < s.length(); i++) {
			int ch = s.charAt(i) - 'a';
			num[ch]++;
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < 26; i++) {
			char c = (char)('a' + i);
			for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			}
		}
		return sb.toString();
	}
} public class Main {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<>();
        for(int i = 0; i  < n; i++) {
        	String s = normalize(sc.next());
        	list.add(s);
        }

        list.add("zzzzzzzzzzzzzzzzzz");//dummy
        Collections.sort(list);

        long ans = 0;
        for(int i = 0; i < list.size(); i++) {
        	for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	}
        }
        System.out.println(ans);
	}

	public static long comb(long num) {
		return num * (num-1) / 2;
	}

	public static String normalize(String s) {
		int [] num = new int [26];
		for(int i = 0; i < s.length(); i++) {
			int ch = s.charAt(i) - 'a';
			num[ch]++;
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < 26; i++) {
			char c = (char)('a' + i);
			for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			}
		}
		return sb.toString();
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<>();
        for(int i = 0; i  < n; i++) {
        	String s = normalize(sc.next());
        	list.add(s);
        }

        list.add("zzzzzzzzzzzzzzzzzz");//dummy
        Collections.sort(list);

        long ans = 0;
        for(int i = 0; i < list.size(); i++) {
        	for(int j = i + 1 ; j < list.size(); j++) {
        		if( ! list.get(i).equals(list.get(j))) {
        			ans += (comb(j - i));
        			i = j -1 ;
        			break;
        		}
        	}
        }
        System.out.println(ans);
	}

	public static long comb(long num) {
		return num * (num-1) / 2;
	}

	public static String normalize(String s) {
		int [] num = new int [26];
		for(int i = 0; i < s.length(); i++) {
			int ch = s.charAt(i) - 'a';
			num[ch]++;
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < 26; i++) {
			char c = (char)('a' + i);
			for(int j = 0; j < num[i]; j++) {
				sb.append(c);
			}
		}
		return sb.toString();
	}
}