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

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] = toSortedString(sc.next());
        }
        Map<String, Counter> map = new HashMap<>();
        long c = 0L;
        for (int i = 0 ; i < n; i++) {
            if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            }
        }
        System.out.println(c);
    }
    private static String toSortedString(String s) {
        char[] array = s.toCharArray();
        Arrays.sort(array);
        return new String(array);
    }
    private static class Counter {
        private long c = 1L;
        private long increment() {
            return this.c++;
        }
    }
} import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner 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] = toSortedString(sc.next());
        }
        Map<String, Counter> map = new HashMap<>();
        long c = 0L;
        for (int i = 0 ; i < n; i++) {
            if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            }
        }
        System.out.println(c);
    }
    private static String toSortedString(String s) {
        char[] array = s.toCharArray();
        Arrays.sort(array);
        return new String(array);
    }
    private static class Counter {
        private long c = 1L;
        private long increment() {
            return this.c++;
        }
    }
} 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] = toSortedString(sc.next());
        }
        Map<String, Counter> map = new HashMap<>();
        long c = 0L;
        for (int i = 0 ; i < n; i++) {
            if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            }
        }
        System.out.println(c);
    } 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] = toSortedString(sc.next());
        }
        Map<String, Counter> map = new HashMap<>();
        long c = 0L;
        for (int i = 0 ; i < n; i++) {
            if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            }
        }
        System.out.println(c);
    } 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] = toSortedString(sc.next());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = toSortedString(sc.next());
        } {
            s[i] = toSortedString(sc.next());
        } s[i] = toSortedString(sc.next()) s[i] s i toSortedString(sc.next()) toSortedString sc.next() sc.next sc Map<String, Counter> map = new HashMap<>(); map new HashMap<>() long c = 0L; c 0L for (int i = 0 ; i < n; i++) {
            if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            }
        } int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
            if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            }
        } {
            if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            }
        } if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            } map.containsKey(s[i]) map.containsKey map s[i] s i {
                c += map.get(s[i]).increment();
            } c += map.get(s[i]).increment() c map.get(s[i]).increment() map.get(s[i]).increment map.get(s[i]) map.get map s[i] s i {
                map.put(s[i], new Counter());
            } map.put(s[i], new Counter()) map.put map s[i] s i new Counter() System.out.println(c) System.out.println System.out System System.out c String[] args args private static String toSortedString(String s) {
        char[] array = s.toCharArray();
        Arrays.sort(array);
        return new String(array);
    } toSortedString {
        char[] array = s.toCharArray();
        Arrays.sort(array);
        return new String(array);
    } char[] array = s.toCharArray(); array s.toCharArray() s.toCharArray s Arrays.sort(array) Arrays.sort Arrays array return new String(array); new String(array) String s s private static class Counter {
        private long c = 1L;
        private long increment() {
            return this.c++;
        }
    } Counter private long c = 1L; c 1L private long increment() {
            return this.c++;
        } increment {
            return this.c++;
        } return this.c++; this.c++ this.c this this.c 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] = toSortedString(sc.next());
        }
        Map<String, Counter> map = new HashMap<>();
        long c = 0L;
        for (int i = 0 ; i < n; i++) {
            if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            }
        }
        System.out.println(c);
    }
    private static String toSortedString(String s) {
        char[] array = s.toCharArray();
        Arrays.sort(array);
        return new String(array);
    }
    private static class Counter {
        private long c = 1L;
        private long increment() {
            return this.c++;
        }
    }
} 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] = toSortedString(sc.next());
        }
        Map<String, Counter> map = new HashMap<>();
        long c = 0L;
        for (int i = 0 ; i < n; i++) {
            if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            }
        }
        System.out.println(c);
    }
    private static String toSortedString(String s) {
        char[] array = s.toCharArray();
        Arrays.sort(array);
        return new String(array);
    }
    private static class Counter {
        private long c = 1L;
        private long increment() {
            return this.c++;
        }
    }
} Main
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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] = toSortedString(sc.next());
        }
        Map<String, Counter> map = new HashMap<>();
        long c = 0L;
        for (int i = 0 ; i < n; i++) {
            if (map.containsKey(s[i])) {
                c += map.get(s[i]).increment();
            } else {
                map.put(s[i], new Counter());
            }
        }
        System.out.println(c);
    }
    private static String toSortedString(String s) {
        char[] array = s.toCharArray();
        Arrays.sort(array);
        return new String(array);
    }
    private static class Counter {
        private long c = 1L;
        private long increment() {
            return this.c++;
        }
    }
}
