import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();

        String[] s = new String[N];
        for(int i = 0; i < N; i++)
            s[i] = sc.next();       
        
        long count = 0;
        int[][] str = new int[N][26];
        String[] str2 = new String[N];
        for(int j = 0; j < N; j++){
            for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            }
            str2[j] = Arrays.toString(str[j]);
        }

        long first = 1;
        Map<String, Long> map = new HashMap<>();
        for(int i = 0; i < N; i++){
            if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            }
        }

        for(long val: map.values()){
            count += comb2(val);
        }
        System.out.println(count);
        sc.close();
    }

    static long comb2(long n){
        return n * (n-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();

        String[] s = new String[N];
        for(int i = 0; i < N; i++)
            s[i] = sc.next();       
        
        long count = 0;
        int[][] str = new int[N][26];
        String[] str2 = new String[N];
        for(int j = 0; j < N; j++){
            for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            }
            str2[j] = Arrays.toString(str[j]);
        }

        long first = 1;
        Map<String, Long> map = new HashMap<>();
        for(int i = 0; i < N; i++){
            if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            }
        }

        for(long val: map.values()){
            count += comb2(val);
        }
        System.out.println(count);
        sc.close();
    }

    static long comb2(long n){
        return n * (n-1) / 2;
    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();

        String[] s = new String[N];
        for(int i = 0; i < N; i++)
            s[i] = sc.next();       
        
        long count = 0;
        int[][] str = new int[N][26];
        String[] str2 = new String[N];
        for(int j = 0; j < N; j++){
            for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            }
            str2[j] = Arrays.toString(str[j]);
        }

        long first = 1;
        Map<String, Long> map = new HashMap<>();
        for(int i = 0; i < N; i++){
            if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            }
        }

        for(long val: map.values()){
            count += comb2(val);
        }
        System.out.println(count);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();

        String[] s = new String[N];
        for(int i = 0; i < N; i++)
            s[i] = sc.next();       
        
        long count = 0;
        int[][] str = new int[N][26];
        String[] str2 = new String[N];
        for(int j = 0; j < N; j++){
            for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            }
            str2[j] = Arrays.toString(str[j]);
        }

        long first = 1;
        Map<String, Long> map = new HashMap<>();
        for(int i = 0; i < N; i++){
            if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            }
        }

        for(long val: map.values()){
            count += comb2(val);
        }
        System.out.println(count);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc String[] s = new String[N]; s new String[N] N for(int i = 0; i < N; i++)
            s[i] = sc.next(); int i = 0; int i = 0; i 0 i < N i N i++ i++ i s[i] = sc.next(); s[i] = sc.next() s[i] s i sc.next() sc.next sc long count = 0; count 0 int[][] str = new int[N][26]; str new int[N][26] N 26 String[] str2 = new String[N]; str2 new String[N] N for(int j = 0; j < N; j++){
            for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            }
            str2[j] = Arrays.toString(str[j]);
        } int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
            for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            }
            str2[j] = Arrays.toString(str[j]);
        } {
            for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            }
            str2[j] = Arrays.toString(str[j]);
        } for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            } int i = 0; int i = 0; i 0 i < s[j].length() i s[j].length() s[j].length s[j] s j i++ i++ i {
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            } {
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            } if(s[j].charAt(i) == 'a')
                    str[j][0]++; s[j].charAt(i) == 'a' s[j].charAt(i) s[j].charAt s[j] s j i 'a' str[j][0]++ str[j][0] str[j] str j 0 if(s[j].charAt(i) == 'b')
                    str[j][1]++; s[j].charAt(i) == 'b' s[j].charAt(i) s[j].charAt s[j] s j i 'b' str[j][1]++ str[j][1] str[j] str j 1 if(s[j].charAt(i) == 'c')
                    str[j][2]++; s[j].charAt(i) == 'c' s[j].charAt(i) s[j].charAt s[j] s j i 'c' str[j][2]++ str[j][2] str[j] str j 2 if(s[j].charAt(i) == 'd')
                    str[j][3]++; s[j].charAt(i) == 'd' s[j].charAt(i) s[j].charAt s[j] s j i 'd' str[j][3]++ str[j][3] str[j] str j 3 if(s[j].charAt(i) == 'e')
                    str[j][4]++; s[j].charAt(i) == 'e' s[j].charAt(i) s[j].charAt s[j] s j i 'e' str[j][4]++ str[j][4] str[j] str j 4 if(s[j].charAt(i) == 'f')
                    str[j][5]++; s[j].charAt(i) == 'f' s[j].charAt(i) s[j].charAt s[j] s j i 'f' str[j][5]++ str[j][5] str[j] str j 5 if(s[j].charAt(i) == 'g')
                    str[j][6]++; s[j].charAt(i) == 'g' s[j].charAt(i) s[j].charAt s[j] s j i 'g' str[j][6]++ str[j][6] str[j] str j 6 if(s[j].charAt(i) == 'h')
                    str[j][7]++; s[j].charAt(i) == 'h' s[j].charAt(i) s[j].charAt s[j] s j i 'h' str[j][7]++ str[j][7] str[j] str j 7 if(s[j].charAt(i) == 'i')
                    str[j][8]++; s[j].charAt(i) == 'i' s[j].charAt(i) s[j].charAt s[j] s j i 'i' str[j][8]++ str[j][8] str[j] str j 8 if(s[j].charAt(i) == 'j')
                    str[j][9]++; s[j].charAt(i) == 'j' s[j].charAt(i) s[j].charAt s[j] s j i 'j' str[j][9]++ str[j][9] str[j] str j 9 if(s[j].charAt(i) == 'k')
                    str[j][10]++; s[j].charAt(i) == 'k' s[j].charAt(i) s[j].charAt s[j] s j i 'k' str[j][10]++ str[j][10] str[j] str j 10 if(s[j].charAt(i) == 'l')
                    str[j][11]++; s[j].charAt(i) == 'l' s[j].charAt(i) s[j].charAt s[j] s j i 'l' str[j][11]++ str[j][11] str[j] str j 11 if(s[j].charAt(i) == 'm')
                    str[j][12]++; s[j].charAt(i) == 'm' s[j].charAt(i) s[j].charAt s[j] s j i 'm' str[j][12]++ str[j][12] str[j] str j 12 if(s[j].charAt(i) == 'n')
                    str[j][13]++; s[j].charAt(i) == 'n' s[j].charAt(i) s[j].charAt s[j] s j i 'n' str[j][13]++ str[j][13] str[j] str j 13 if(s[j].charAt(i) == 'o')
                    str[j][14]++; s[j].charAt(i) == 'o' s[j].charAt(i) s[j].charAt s[j] s j i 'o' str[j][14]++ str[j][14] str[j] str j 14 if(s[j].charAt(i) == 'p')
                    str[j][15]++; s[j].charAt(i) == 'p' s[j].charAt(i) s[j].charAt s[j] s j i 'p' str[j][15]++ str[j][15] str[j] str j 15 if(s[j].charAt(i) == 'q')
                    str[j][16]++; s[j].charAt(i) == 'q' s[j].charAt(i) s[j].charAt s[j] s j i 'q' str[j][16]++ str[j][16] str[j] str j 16 if(s[j].charAt(i) == 'r')
                    str[j][17]++; s[j].charAt(i) == 'r' s[j].charAt(i) s[j].charAt s[j] s j i 'r' str[j][17]++ str[j][17] str[j] str j 17 if(s[j].charAt(i) == 's')
                    str[j][18]++; s[j].charAt(i) == 's' s[j].charAt(i) s[j].charAt s[j] s j i 's' str[j][18]++ str[j][18] str[j] str j 18 if(s[j].charAt(i) == 't')
                    str[j][19]++; s[j].charAt(i) == 't' s[j].charAt(i) s[j].charAt s[j] s j i 't' str[j][19]++ str[j][19] str[j] str j 19 if(s[j].charAt(i) == 'u')
                    str[j][20]++; s[j].charAt(i) == 'u' s[j].charAt(i) s[j].charAt s[j] s j i 'u' str[j][20]++ str[j][20] str[j] str j 20 if(s[j].charAt(i) == 'v')
                    str[j][21]++; s[j].charAt(i) == 'v' s[j].charAt(i) s[j].charAt s[j] s j i 'v' str[j][21]++ str[j][21] str[j] str j 21 if(s[j].charAt(i) == 'w')
                    str[j][22]++; s[j].charAt(i) == 'w' s[j].charAt(i) s[j].charAt s[j] s j i 'w' str[j][22]++ str[j][22] str[j] str j 22 if(s[j].charAt(i) == 'x')
                    str[j][23]++; s[j].charAt(i) == 'x' s[j].charAt(i) s[j].charAt s[j] s j i 'x' str[j][23]++ str[j][23] str[j] str j 23 if(s[j].charAt(i) == 'y')
                    str[j][24]++; s[j].charAt(i) == 'y' s[j].charAt(i) s[j].charAt s[j] s j i 'y' str[j][24]++ str[j][24] str[j] str j 24 if(s[j].charAt(i) == 'z')
                    str[j][25]++; s[j].charAt(i) == 'z' s[j].charAt(i) s[j].charAt s[j] s j i 'z' str[j][25]++ str[j][25] str[j] str j 25 str2[j] = Arrays.toString(str[j]) str2[j] str2 j Arrays.toString(str[j]) Arrays.toString Arrays str[j] str j long first = 1; first 1 Map<String, Long> map = new HashMap<>(); map new HashMap<>() for(int i = 0; i < N; i++){
            if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            }
        } {
            if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            }
        } if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            } map.containsKey(str2[i]) map.containsKey map str2[i] str2 i {
                map.put(str2[i], map.get(str2[i])+first);
            } map.put(str2[i], map.get(str2[i])+first) map.put map str2[i] str2 i map.get(str2[i])+first map.get(str2[i]) map.get map str2[i] str2 i first {
                map.put(str2[i], first);
            } map.put(str2[i], first) map.put map str2[i] str2 i first for(long val: map.values()){
            count += comb2(val);
        } long val map.values() map.values map {
            count += comb2(val);
        } {
            count += comb2(val);
        } count += comb2(val) count comb2(val) comb2 val System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc String args[] args static long comb2(long n){
        return n * (n-1) / 2;
    } comb2 {
        return n * (n-1) / 2;
    } return n * (n-1) / 2; n * (n-1) / 2 n * (n-1) n (n-1) n 1 2 long n n public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();

        String[] s = new String[N];
        for(int i = 0; i < N; i++)
            s[i] = sc.next();       
        
        long count = 0;
        int[][] str = new int[N][26];
        String[] str2 = new String[N];
        for(int j = 0; j < N; j++){
            for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            }
            str2[j] = Arrays.toString(str[j]);
        }

        long first = 1;
        Map<String, Long> map = new HashMap<>();
        for(int i = 0; i < N; i++){
            if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            }
        }

        for(long val: map.values()){
            count += comb2(val);
        }
        System.out.println(count);
        sc.close();
    }

    static long comb2(long n){
        return n * (n-1) / 2;
    }
} public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();

        String[] s = new String[N];
        for(int i = 0; i < N; i++)
            s[i] = sc.next();       
        
        long count = 0;
        int[][] str = new int[N][26];
        String[] str2 = new String[N];
        for(int j = 0; j < N; j++){
            for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            }
            str2[j] = Arrays.toString(str[j]);
        }

        long first = 1;
        Map<String, Long> map = new HashMap<>();
        for(int i = 0; i < N; i++){
            if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            }
        }

        for(long val: map.values()){
            count += comb2(val);
        }
        System.out.println(count);
        sc.close();
    }

    static long comb2(long n){
        return n * (n-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();

        String[] s = new String[N];
        for(int i = 0; i < N; i++)
            s[i] = sc.next();       
        
        long count = 0;
        int[][] str = new int[N][26];
        String[] str2 = new String[N];
        for(int j = 0; j < N; j++){
            for(int i = 0; i < s[j].length(); i++){
                if(s[j].charAt(i) == 'a')
                    str[j][0]++;
                if(s[j].charAt(i) == 'b')
                    str[j][1]++;
                if(s[j].charAt(i) == 'c')
                    str[j][2]++;
                if(s[j].charAt(i) == 'd')
                    str[j][3]++;
                if(s[j].charAt(i) == 'e')
                    str[j][4]++;
                if(s[j].charAt(i) == 'f')
                    str[j][5]++;
                if(s[j].charAt(i) == 'g')
                    str[j][6]++;
                if(s[j].charAt(i) == 'h')
                    str[j][7]++;
                if(s[j].charAt(i) == 'i')
                    str[j][8]++;
                if(s[j].charAt(i) == 'j')
                    str[j][9]++;
                if(s[j].charAt(i) == 'k')
                    str[j][10]++;
                if(s[j].charAt(i) == 'l')
                    str[j][11]++;
                if(s[j].charAt(i) == 'm')
                    str[j][12]++;
                if(s[j].charAt(i) == 'n')
                    str[j][13]++;
                if(s[j].charAt(i) == 'o')
                    str[j][14]++;
                if(s[j].charAt(i) == 'p')
                    str[j][15]++;
                if(s[j].charAt(i) == 'q')
                    str[j][16]++;
                if(s[j].charAt(i) == 'r')
                    str[j][17]++;
                if(s[j].charAt(i) == 's')
                    str[j][18]++;
                if(s[j].charAt(i) == 't')
                    str[j][19]++;
                if(s[j].charAt(i) == 'u')
                    str[j][20]++;
                if(s[j].charAt(i) == 'v')
                    str[j][21]++;
                if(s[j].charAt(i) == 'w')
                    str[j][22]++;
                if(s[j].charAt(i) == 'x')
                    str[j][23]++;
                if(s[j].charAt(i) == 'y')
                    str[j][24]++;
                if(s[j].charAt(i) == 'z')
                    str[j][25]++; 
            }
            str2[j] = Arrays.toString(str[j]);
        }

        long first = 1;
        Map<String, Long> map = new HashMap<>();
        for(int i = 0; i < N; i++){
            if(map.containsKey(str2[i])){
                map.put(str2[i], map.get(str2[i])+first);
            } else {
                map.put(str2[i], first);
            }
        }

        for(long val: map.values()){
            count += comb2(val);
        }
        System.out.println(count);
        sc.close();
    }

    static long comb2(long n){
        return n * (n-1) / 2;
    }
}
