
import java.util.*;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
//        long a = calcNumOfCombination(99999999, 2);
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        char[] s = new char[10];
        Map<String, Long> hoge = new HashMap<>();
        for (int i = 0; i < N; i++) {
            scanner.next().getChars(0, 10, s, 0);
            Arrays.sort(s);
            String fuga = String.valueOf(s);
            if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            }

        }
        long count = 0;
        for (String key : hoge.keySet()) {
            Long p = hoge.get(key);
            if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            }
        }

        System.out.println(count);
    }

    long calcNumOfCombination(long n, long r){
        long num = 1;
        for(long i = 1; i <= r; i++){
            num = num * (n - i + 1) / i;
        }
        return num;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
//        long a = calcNumOfCombination(99999999, 2);
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        char[] s = new char[10];
        Map<String, Long> hoge = new HashMap<>();
        for (int i = 0; i < N; i++) {
            scanner.next().getChars(0, 10, s, 0);
            Arrays.sort(s);
            String fuga = String.valueOf(s);
            if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            }

        }
        long count = 0;
        for (String key : hoge.keySet()) {
            Long p = hoge.get(key);
            if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            }
        }

        System.out.println(count);
    }

    long calcNumOfCombination(long n, long r){
        long num = 1;
        for(long i = 1; i <= r; i++){
            num = num * (n - i + 1) / i;
        }
        return num;
    }
} Main public static void main(String[] args) {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args private void run() {
//        long a = calcNumOfCombination(99999999, 2);
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        char[] s = new char[10];
        Map<String, Long> hoge = new HashMap<>();
        for (int i = 0; i < N; i++) {
            scanner.next().getChars(0, 10, s, 0);
            Arrays.sort(s);
            String fuga = String.valueOf(s);
            if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            }

        }
        long count = 0;
        for (String key : hoge.keySet()) {
            Long p = hoge.get(key);
            if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            }
        }

        System.out.println(count);
    } run {
//        long a = calcNumOfCombination(99999999, 2);
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        char[] s = new char[10];
        Map<String, Long> hoge = new HashMap<>();
        for (int i = 0; i < N; i++) {
            scanner.next().getChars(0, 10, s, 0);
            Arrays.sort(s);
            String fuga = String.valueOf(s);
            if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            }

        }
        long count = 0;
        for (String key : hoge.keySet()) {
            Long p = hoge.get(key);
            if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            }
        }

        System.out.println(count);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner char[] s = new char[10]; s new char[10] 10 Map<String, Long> hoge = new HashMap<>(); hoge new HashMap<>() for (int i = 0; i < N; i++) {
            scanner.next().getChars(0, 10, s, 0);
            Arrays.sort(s);
            String fuga = String.valueOf(s);
            if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            }

        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            scanner.next().getChars(0, 10, s, 0);
            Arrays.sort(s);
            String fuga = String.valueOf(s);
            if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            }

        } {
            scanner.next().getChars(0, 10, s, 0);
            Arrays.sort(s);
            String fuga = String.valueOf(s);
            if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            }

        } scanner.next().getChars(0, 10, s, 0) scanner.next().getChars scanner.next() scanner.next scanner 0 10 s 0 Arrays.sort(s) Arrays.sort Arrays s String fuga = String.valueOf(s); fuga String.valueOf(s) String.valueOf String s if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            } hoge.containsKey(fuga) hoge.containsKey hoge fuga {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } hoge.put(fuga, hoge.get(fuga) + 1) hoge.put hoge fuga hoge.get(fuga) + 1 hoge.get(fuga) hoge.get hoge fuga 1 {
                hoge.put(fuga, 1L);
            } hoge.put(fuga, 1L) hoge.put hoge fuga 1L long count = 0; count 0 for (String key : hoge.keySet()) {
            Long p = hoge.get(key);
            if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            }
        } String key hoge.keySet() hoge.keySet hoge {
            Long p = hoge.get(key);
            if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            }
        } {
            Long p = hoge.get(key);
            if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            }
        } Long p = hoge.get(key); p hoge.get(key) hoge.get hoge key if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            } p >= 2 p 2 {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            } long tmp = calcNumOfCombination(p, 2); tmp calcNumOfCombination(p, 2) calcNumOfCombination p 2 count += tmp count tmp System.out.println(count) System.out.println System.out System System.out count long calcNumOfCombination(long n, long r){
        long num = 1;
        for(long i = 1; i <= r; i++){
            num = num * (n - i + 1) / i;
        }
        return num;
    } calcNumOfCombination {
        long num = 1;
        for(long i = 1; i <= r; i++){
            num = num * (n - i + 1) / i;
        }
        return num;
    } long num = 1; num 1 for(long i = 1; i <= r; i++){
            num = num * (n - i + 1) / i;
        } long i = 1; long i = 1; i 1 i <= r i r i++ i++ i {
            num = num * (n - i + 1) / i;
        } {
            num = num * (n - i + 1) / i;
        } num = num * (n - i + 1) / i num num * (n - i + 1) / i num * (n - i + 1) num (n - i + 1) n - i n i 1 i return num; num long n n long r r public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
//        long a = calcNumOfCombination(99999999, 2);
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        char[] s = new char[10];
        Map<String, Long> hoge = new HashMap<>();
        for (int i = 0; i < N; i++) {
            scanner.next().getChars(0, 10, s, 0);
            Arrays.sort(s);
            String fuga = String.valueOf(s);
            if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            }

        }
        long count = 0;
        for (String key : hoge.keySet()) {
            Long p = hoge.get(key);
            if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            }
        }

        System.out.println(count);
    }

    long calcNumOfCombination(long n, long r){
        long num = 1;
        for(long i = 1; i <= r; i++){
            num = num * (n - i + 1) / i;
        }
        return num;
    }
} public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
//        long a = calcNumOfCombination(99999999, 2);
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        char[] s = new char[10];
        Map<String, Long> hoge = new HashMap<>();
        for (int i = 0; i < N; i++) {
            scanner.next().getChars(0, 10, s, 0);
            Arrays.sort(s);
            String fuga = String.valueOf(s);
            if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            }

        }
        long count = 0;
        for (String key : hoge.keySet()) {
            Long p = hoge.get(key);
            if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            }
        }

        System.out.println(count);
    }

    long calcNumOfCombination(long n, long r){
        long num = 1;
        for(long i = 1; i <= r; i++){
            num = num * (n - i + 1) / i;
        }
        return num;
    }
} Main

import java.util.*;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
//        long a = calcNumOfCombination(99999999, 2);
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        char[] s = new char[10];
        Map<String, Long> hoge = new HashMap<>();
        for (int i = 0; i < N; i++) {
            scanner.next().getChars(0, 10, s, 0);
            Arrays.sort(s);
            String fuga = String.valueOf(s);
            if (hoge.containsKey(fuga)) {
                hoge.put(fuga, hoge.get(fuga) + 1);
            } else {
                hoge.put(fuga, 1L);
            }

        }
        long count = 0;
        for (String key : hoge.keySet()) {
            Long p = hoge.get(key);
            if (p >= 2) {
                long tmp = calcNumOfCombination(p, 2);
                count += tmp;
            }
        }

        System.out.println(count);
    }

    long calcNumOfCombination(long n, long r){
        long num = 1;
        for(long i = 1; i <= r; i++){
            num = num * (n - i + 1) / i;
        }
        return num;
    }
}
