import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        String[] array = new String[n];
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            char[] c = str.toCharArray();
            Arrays.sort(c);
            
            String str2 = "";
            for (int j = 0; j < 10; j++) {
                str2 += c[j];
            }
            array[i] = str2;
        }
        Arrays.sort(array);
        String now = array[0];
        long ans = 0;
        long count = 0;
        for (int i = 1; i < n; i++) {
            if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            }
        }
        
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        String[] array = new String[n];
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            char[] c = str.toCharArray();
            Arrays.sort(c);
            
            String str2 = "";
            for (int j = 0; j < 10; j++) {
                str2 += c[j];
            }
            array[i] = str2;
        }
        Arrays.sort(array);
        String now = array[0];
        long ans = 0;
        long count = 0;
        for (int i = 1; i < n; i++) {
            if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            }
        }
        
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        String[] array = new String[n];
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            char[] c = str.toCharArray();
            Arrays.sort(c);
            
            String str2 = "";
            for (int j = 0; j < 10; j++) {
                str2 += c[j];
            }
            array[i] = str2;
        }
        Arrays.sort(array);
        String now = array[0];
        long ans = 0;
        long count = 0;
        for (int i = 1; i < n; i++) {
            if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            }
        }
        
        System.out.println(ans);
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        String[] array = new String[n];
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            char[] c = str.toCharArray();
            Arrays.sort(c);
            
            String str2 = "";
            for (int j = 0; j < 10; j++) {
                str2 += c[j];
            }
            array[i] = str2;
        }
        Arrays.sort(array);
        String now = array[0];
        long ans = 0;
        long count = 0;
        for (int i = 1; i < n; i++) {
            if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            }
        }
        
        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 String[] array = new String[n]; array new String[n] n for (int i = 0; i < n; i++) {
            String str = sc.next();
            char[] c = str.toCharArray();
            Arrays.sort(c);
            
            String str2 = "";
            for (int j = 0; j < 10; j++) {
                str2 += c[j];
            }
            array[i] = str2;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String str = sc.next();
            char[] c = str.toCharArray();
            Arrays.sort(c);
            
            String str2 = "";
            for (int j = 0; j < 10; j++) {
                str2 += c[j];
            }
            array[i] = str2;
        } {
            String str = sc.next();
            char[] c = str.toCharArray();
            Arrays.sort(c);
            
            String str2 = "";
            for (int j = 0; j < 10; j++) {
                str2 += c[j];
            }
            array[i] = str2;
        } String str = sc.next(); str sc.next() sc.next sc char[] c = str.toCharArray(); c str.toCharArray() str.toCharArray str Arrays.sort(c) Arrays.sort Arrays c String str2 = ""; str2 "" for (int j = 0; j < 10; j++) {
                str2 += c[j];
            } int j = 0; int j = 0; j 0 j < 10 j 10 j++ j++ j {
                str2 += c[j];
            } {
                str2 += c[j];
            } str2 += c[j] str2 c[j] c j array[i] = str2 array[i] array i str2 Arrays.sort(array) Arrays.sort Arrays array String now = array[0]; now array[0] array 0 long ans = 0; ans 0 long count = 0; count 0 for (int i = 1; i < n; i++) {
            if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            }
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            }
        } {
            if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            }
        } if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            } array[i].equals(now) array[i].equals array[i] array i now {
                count++;
                ans += count;
            } count++ count ans += count ans count {
                now = array[i];
                count = 0;
            } now = array[i] now array[i] array i count = 0 count 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        String[] array = new String[n];
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            char[] c = str.toCharArray();
            Arrays.sort(c);
            
            String str2 = "";
            for (int j = 0; j < 10; j++) {
                str2 += c[j];
            }
            array[i] = str2;
        }
        Arrays.sort(array);
        String now = array[0];
        long ans = 0;
        long count = 0;
        for (int i = 1; i < n; i++) {
            if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            }
        }
        
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        String[] array = new String[n];
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            char[] c = str.toCharArray();
            Arrays.sort(c);
            
            String str2 = "";
            for (int j = 0; j < 10; j++) {
                str2 += c[j];
            }
            array[i] = str2;
        }
        Arrays.sort(array);
        String now = array[0];
        long ans = 0;
        long count = 0;
        for (int i = 1; i < n; i++) {
            if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            }
        }
        
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        String[] array = new String[n];
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            char[] c = str.toCharArray();
            Arrays.sort(c);
            
            String str2 = "";
            for (int j = 0; j < 10; j++) {
                str2 += c[j];
            }
            array[i] = str2;
        }
        Arrays.sort(array);
        String now = array[0];
        long ans = 0;
        long count = 0;
        for (int i = 1; i < n; i++) {
            if (array[i].equals(now)) {
                count++;
                ans += count;
            } else {
                now = array[i];
                count = 0;
            }
        }
        
        System.out.println(ans);
    }
}
