import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String, Integer> map = new HashMap<>();
        long count = 0;
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            String countStr = mkString(str);
            map.put(countStr, map.getOrDefault(countStr, 0) + 1);
        }
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            int num = entry.getValue();
            count += nC2(num);
        }
        System.out.println(count);
    }

    public static String mkString(String str) {
        int[] count = new int[26];
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            count[c - 'a']++;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 26; i++) {
            sb.append(count[i]);
            char c = (char)(i + 'a');
            sb.append(String.valueOf(c));
        }
        return sb.toString();
    }
    public static long nC2(int num) {
        if (num == 0 || num == 1) return 0;
        return (long)num * (num - 1) / 2;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String, Integer> map = new HashMap<>();
        long count = 0;
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            String countStr = mkString(str);
            map.put(countStr, map.getOrDefault(countStr, 0) + 1);
        }
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            int num = entry.getValue();
            count += nC2(num);
        }
        System.out.println(count);
    }

    public static String mkString(String str) {
        int[] count = new int[26];
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            count[c - 'a']++;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 26; i++) {
            sb.append(count[i]);
            char c = (char)(i + 'a');
            sb.append(String.valueOf(c));
        }
        return sb.toString();
    }
    public static long nC2(int num) {
        if (num == 0 || num == 1) return 0;
        return (long)num * (num - 1) / 2;
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String, Integer> map = new HashMap<>();
        long count = 0;
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            String countStr = mkString(str);
            map.put(countStr, map.getOrDefault(countStr, 0) + 1);
        }
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            int num = entry.getValue();
            count += nC2(num);
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String, Integer> map = new HashMap<>();
        long count = 0;
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            String countStr = mkString(str);
            map.put(countStr, map.getOrDefault(countStr, 0) + 1);
        }
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            int num = entry.getValue();
            count += nC2(num);
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc HashMap<String, Integer> map = new HashMap<>(); map new HashMap<>() long count = 0; count 0 for (int i = 0; i < n; i++) {
            String str = sc.next();
            String countStr = mkString(str);
            map.put(countStr, map.getOrDefault(countStr, 0) + 1);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String str = sc.next();
            String countStr = mkString(str);
            map.put(countStr, map.getOrDefault(countStr, 0) + 1);
        } {
            String str = sc.next();
            String countStr = mkString(str);
            map.put(countStr, map.getOrDefault(countStr, 0) + 1);
        } String str = sc.next(); str sc.next() sc.next sc String countStr = mkString(str); countStr mkString(str) mkString str map.put(countStr, map.getOrDefault(countStr, 0) + 1) map.put map countStr map.getOrDefault(countStr, 0) + 1 map.getOrDefault(countStr, 0) map.getOrDefault map countStr 0 1 for (Map.Entry<String, Integer> entry : map.entrySet()) {
            int num = entry.getValue();
            count += nC2(num);
        } Map.Entry<String, Integer> entry map.entrySet() map.entrySet map {
            int num = entry.getValue();
            count += nC2(num);
        } {
            int num = entry.getValue();
            count += nC2(num);
        } int num = entry.getValue(); num entry.getValue() entry.getValue entry count += nC2(num) count nC2(num) nC2 num System.out.println(count) System.out.println System.out System System.out count String args[] args public static String mkString(String str) {
        int[] count = new int[26];
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            count[c - 'a']++;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 26; i++) {
            sb.append(count[i]);
            char c = (char)(i + 'a');
            sb.append(String.valueOf(c));
        }
        return sb.toString();
    } mkString {
        int[] count = new int[26];
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            count[c - 'a']++;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 26; i++) {
            sb.append(count[i]);
            char c = (char)(i + 'a');
            sb.append(String.valueOf(c));
        }
        return sb.toString();
    } int[] count = new int[26]; count new int[26] 26 for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            count[c - 'a']++;
        } int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str i++ i++ i {
            char c = str.charAt(i);
            count[c - 'a']++;
        } {
            char c = str.charAt(i);
            count[c - 'a']++;
        } char c = str.charAt(i); c str.charAt(i) str.charAt str i count[c - 'a']++ count[c - 'a'] count c - 'a' c 'a' StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0; i < 26; i++) {
            sb.append(count[i]);
            char c = (char)(i + 'a');
            sb.append(String.valueOf(c));
        } int i = 0; int i = 0; i 0 i < 26 i 26 i++ i++ i {
            sb.append(count[i]);
            char c = (char)(i + 'a');
            sb.append(String.valueOf(c));
        } {
            sb.append(count[i]);
            char c = (char)(i + 'a');
            sb.append(String.valueOf(c));
        } sb.append(count[i]) sb.append sb count[i] count i char c = (char)(i + 'a'); c (char)(i + 'a') i 'a' sb.append(String.valueOf(c)) sb.append sb String.valueOf(c) String.valueOf String c return sb.toString(); sb.toString() sb.toString sb String str str public static long nC2(int num) {
        if (num == 0 || num == 1) return 0;
        return (long)num * (num - 1) / 2;
    } nC2 {
        if (num == 0 || num == 1) return 0;
        return (long)num * (num - 1) / 2;
    } if (num == 0 || num == 1) return 0; num == 0 || num == 1 num == 0 num 0 num == 1 num 1 return 0; 0 return (long)num * (num - 1) / 2; (long)num * (num - 1) / 2 (long)num * (num - 1) (long)num (num - 1) num 1 2 int num num public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String, Integer> map = new HashMap<>();
        long count = 0;
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            String countStr = mkString(str);
            map.put(countStr, map.getOrDefault(countStr, 0) + 1);
        }
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            int num = entry.getValue();
            count += nC2(num);
        }
        System.out.println(count);
    }

    public static String mkString(String str) {
        int[] count = new int[26];
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            count[c - 'a']++;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 26; i++) {
            sb.append(count[i]);
            char c = (char)(i + 'a');
            sb.append(String.valueOf(c));
        }
        return sb.toString();
    }
    public static long nC2(int num) {
        if (num == 0 || num == 1) return 0;
        return (long)num * (num - 1) / 2;
    }
} public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String, Integer> map = new HashMap<>();
        long count = 0;
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            String countStr = mkString(str);
            map.put(countStr, map.getOrDefault(countStr, 0) + 1);
        }
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            int num = entry.getValue();
            count += nC2(num);
        }
        System.out.println(count);
    }

    public static String mkString(String str) {
        int[] count = new int[26];
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            count[c - 'a']++;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 26; i++) {
            sb.append(count[i]);
            char c = (char)(i + 'a');
            sb.append(String.valueOf(c));
        }
        return sb.toString();
    }
    public static long nC2(int num) {
        if (num == 0 || num == 1) return 0;
        return (long)num * (num - 1) / 2;
    }
} Main
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String, Integer> map = new HashMap<>();
        long count = 0;
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            String countStr = mkString(str);
            map.put(countStr, map.getOrDefault(countStr, 0) + 1);
        }
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            int num = entry.getValue();
            count += nC2(num);
        }
        System.out.println(count);
    }

    public static String mkString(String str) {
        int[] count = new int[26];
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            count[c - 'a']++;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 26; i++) {
            sb.append(count[i]);
            char c = (char)(i + 'a');
            sb.append(String.valueOf(c));
        }
        return sb.toString();
    }
    public static long nC2(int num) {
        if (num == 0 || num == 1) return 0;
        return (long)num * (num - 1) / 2;
    }
}
