

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

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

        int n = sc.nextInt();
        long ans = 0;
        int FirstPutValue = 1;
        HashMap<String, Integer> map = new HashMap<String, Integer>();

        for (int i = 0; i < n; i++ ) {
            String s = sc.next();
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            String key = new String(chars);

            if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            }
        }

        System.out.println(ans);

        sc.close();
    }
} import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        long ans = 0;
        int FirstPutValue = 1;
        HashMap<String, Integer> map = new HashMap<String, Integer>();

        for (int i = 0; i < n; i++ ) {
            String s = sc.next();
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            String key = new String(chars);

            if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            }
        }

        System.out.println(ans);

        sc.close();
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        long ans = 0;
        int FirstPutValue = 1;
        HashMap<String, Integer> map = new HashMap<String, Integer>();

        for (int i = 0; i < n; i++ ) {
            String s = sc.next();
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            String key = new String(chars);

            if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            }
        }

        System.out.println(ans);

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        long ans = 0;
        int FirstPutValue = 1;
        HashMap<String, Integer> map = new HashMap<String, Integer>();

        for (int i = 0; i < n; i++ ) {
            String s = sc.next();
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            String key = new String(chars);

            if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            }
        }

        System.out.println(ans);

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long ans = 0; ans 0 int FirstPutValue = 1; FirstPutValue 1 HashMap<String, Integer> map = new HashMap<String, Integer>(); map new HashMap<String, Integer>() for (int i = 0; i < n; i++ ) {
            String s = sc.next();
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            String key = new String(chars);

            if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String s = sc.next();
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            String key = new String(chars);

            if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            }
        } {
            String s = sc.next();
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            String key = new String(chars);

            if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            }
        } String s = sc.next(); s sc.next() sc.next sc char[] chars = s.toCharArray(); chars s.toCharArray() s.toCharArray s Arrays.sort(chars) Arrays.sort Arrays chars String key = new String(chars); key new String(chars) if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            } map.containsKey(key) map.containsKey map key {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } int value = map.get(key); value map.get(key) map.get map key ans += value ans value map.put(key, value + 1) map.put map key value + 1 value 1 {
                map.put(key, FirstPutValue);
            } map.put(key, FirstPutValue) map.put map key FirstPutValue System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        long ans = 0;
        int FirstPutValue = 1;
        HashMap<String, Integer> map = new HashMap<String, Integer>();

        for (int i = 0; i < n; i++ ) {
            String s = sc.next();
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            String key = new String(chars);

            if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            }
        }

        System.out.println(ans);

        sc.close();
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        long ans = 0;
        int FirstPutValue = 1;
        HashMap<String, Integer> map = new HashMap<String, Integer>();

        for (int i = 0; i < n; i++ ) {
            String s = sc.next();
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            String key = new String(chars);

            if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            }
        }

        System.out.println(ans);

        sc.close();
    }
} Main


import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

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

        int n = sc.nextInt();
        long ans = 0;
        int FirstPutValue = 1;
        HashMap<String, Integer> map = new HashMap<String, Integer>();

        for (int i = 0; i < n; i++ ) {
            String s = sc.next();
            char[] chars = s.toCharArray();
            Arrays.sort(chars);
            String key = new String(chars);

            if (map.containsKey(key)) {
                int value = map.get(key);
                ans += value;
                map.put(key, value + 1);
            } else {
                map.put(key, FirstPutValue);
            }
        }

        System.out.println(ans);

        sc.close();
    }
}