import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

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

        List<String> list = new ArrayList<>();

        for (int i=0; i<num; i++) {
            char[] str = sc.next().toCharArray();
            Arrays.sort(str);
            list.add(String.valueOf(str));
        }

        long count = 0;
        Map<String, Long> map = new HashMap<>();

        for (int i=0; i<num; i++) {
            String input = list.get(i);

            if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            }
        }

        System.out.println(count);
    }
} import java.io.File; File java.io import java.io.FileInputStream; FileInputStream java.io import java.io.FileNotFoundException; FileNotFoundException java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();

        List<String> list = new ArrayList<>();

        for (int i=0; i<num; i++) {
            char[] str = sc.next().toCharArray();
            Arrays.sort(str);
            list.add(String.valueOf(str));
        }

        long count = 0;
        Map<String, Long> map = new HashMap<>();

        for (int i=0; i<num; i++) {
            String input = list.get(i);

            if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            }
        }

        System.out.println(count);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();

        List<String> list = new ArrayList<>();

        for (int i=0; i<num; i++) {
            char[] str = sc.next().toCharArray();
            Arrays.sort(str);
            list.add(String.valueOf(str));
        }

        long count = 0;
        Map<String, Long> map = new HashMap<>();

        for (int i=0; i<num; i++) {
            String input = list.get(i);

            if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            }
        }

        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();

        List<String> list = new ArrayList<>();

        for (int i=0; i<num; i++) {
            char[] str = sc.next().toCharArray();
            Arrays.sort(str);
            list.add(String.valueOf(str));
        }

        long count = 0;
        Map<String, Long> map = new HashMap<>();

        for (int i=0; i<num; i++) {
            String input = list.get(i);

            if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            }
        }

        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc List<String> list = new ArrayList<>(); list new ArrayList<>() for (int i=0; i<num; i++) {
            char[] str = sc.next().toCharArray();
            Arrays.sort(str);
            list.add(String.valueOf(str));
        } int i=0; int i=0; i 0 i<num i num i++ i++ i {
            char[] str = sc.next().toCharArray();
            Arrays.sort(str);
            list.add(String.valueOf(str));
        } {
            char[] str = sc.next().toCharArray();
            Arrays.sort(str);
            list.add(String.valueOf(str));
        } char[] str = sc.next().toCharArray(); str sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(str) Arrays.sort Arrays str list.add(String.valueOf(str)) list.add list String.valueOf(str) String.valueOf String str long count = 0; count 0 Map<String, Long> map = new HashMap<>(); map new HashMap<>() for (int i=0; i<num; i++) {
            String input = list.get(i);

            if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            }
        } int i=0; int i=0; i 0 i<num i num i++ i++ i {
            String input = list.get(i);

            if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            }
        } {
            String input = list.get(i);

            if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            }
        } String input = list.get(i); input list.get(i) list.get list i if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            } map.containsKey(input) map.containsKey map input {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } count += map.get(input) count map.get(input) map.get map input map.put(input, map.get(input) + 1L) map.put map input map.get(input) + 1L map.get(input) map.get map input 1L {
                map.put(input, 1L);
            } map.put(input, 1L) map.put map input 1L System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();

        List<String> list = new ArrayList<>();

        for (int i=0; i<num; i++) {
            char[] str = sc.next().toCharArray();
            Arrays.sort(str);
            list.add(String.valueOf(str));
        }

        long count = 0;
        Map<String, Long> map = new HashMap<>();

        for (int i=0; i<num; i++) {
            String input = list.get(i);

            if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            }
        }

        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();

        List<String> list = new ArrayList<>();

        for (int i=0; i<num; i++) {
            char[] str = sc.next().toCharArray();
            Arrays.sort(str);
            list.add(String.valueOf(str));
        }

        long count = 0;
        Map<String, Long> map = new HashMap<>();

        for (int i=0; i<num; i++) {
            String input = list.get(i);

            if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            }
        }

        System.out.println(count);
    }
} Main
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

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

        List<String> list = new ArrayList<>();

        for (int i=0; i<num; i++) {
            char[] str = sc.next().toCharArray();
            Arrays.sort(str);
            list.add(String.valueOf(str));
        }

        long count = 0;
        Map<String, Long> map = new HashMap<>();

        for (int i=0; i<num; i++) {
            String input = list.get(i);

            if (map.containsKey(input)) {
                count += map.get(input);
                map.put(input, map.get(input) + 1L);
            } else {
                map.put(input, 1L);
            }
        }

        System.out.println(count);
    }
}
