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

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        String[] Sn;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            Sn = new String[N];
            for (int i = 0; i < N; i++) {
                Sn[i] = sc.next();
            }
        }
        String[] sortedChar = new String[N];
        for (int i = 0; i < N; i++) {
            sortedChar[i] = sortStr(Sn[i]);
        }
        String[] sortedStr = sortStrArr(sortedChar);
        long count = 1;
        long result = 0;
        for (int i = 1; i < N; i++) {
            if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            }
        }
        if (count > 1) {
            result += combi2(count);
        }
        System.out.println(result);
        return;
    }

    private static String sortStr(String str) {
        char[] arr = str.toCharArray();
        Arrays.sort(arr);
        return new String(arr);
    }

    private static String[] sortStrArr(String[] strArr) {
        Arrays.sort(strArr);
        return strArr;
    }

    private static long combi2(long count) {
        return count * (count - 1) / 2;
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        String[] Sn;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            Sn = new String[N];
            for (int i = 0; i < N; i++) {
                Sn[i] = sc.next();
            }
        }
        String[] sortedChar = new String[N];
        for (int i = 0; i < N; i++) {
            sortedChar[i] = sortStr(Sn[i]);
        }
        String[] sortedStr = sortStrArr(sortedChar);
        long count = 1;
        long result = 0;
        for (int i = 1; i < N; i++) {
            if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            }
        }
        if (count > 1) {
            result += combi2(count);
        }
        System.out.println(result);
        return;
    }

    private static String sortStr(String str) {
        char[] arr = str.toCharArray();
        Arrays.sort(arr);
        return new String(arr);
    }

    private static String[] sortStrArr(String[] strArr) {
        Arrays.sort(strArr);
        return strArr;
    }

    private static long combi2(long count) {
        return count * (count - 1) / 2;
    }
} Main public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    } debug {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    } boolean debug = false; debug false if (debug != false) {
            return;
        } debug != false debug false {
            return;
        } return; System.out.println(str) System.out.println System.out System System.out str String str str public static void main(String[] args) {

        int N;
        String[] Sn;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            Sn = new String[N];
            for (int i = 0; i < N; i++) {
                Sn[i] = sc.next();
            }
        }
        String[] sortedChar = new String[N];
        for (int i = 0; i < N; i++) {
            sortedChar[i] = sortStr(Sn[i]);
        }
        String[] sortedStr = sortStrArr(sortedChar);
        long count = 1;
        long result = 0;
        for (int i = 1; i < N; i++) {
            if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            }
        }
        if (count > 1) {
            result += combi2(count);
        }
        System.out.println(result);
        return;
    } main {

        int N;
        String[] Sn;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            Sn = new String[N];
            for (int i = 0; i < N; i++) {
                Sn[i] = sc.next();
            }
        }
        String[] sortedChar = new String[N];
        for (int i = 0; i < N; i++) {
            sortedChar[i] = sortStr(Sn[i]);
        }
        String[] sortedStr = sortStrArr(sortedChar);
        long count = 1;
        long result = 0;
        for (int i = 1; i < N; i++) {
            if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            }
        }
        if (count > 1) {
            result += combi2(count);
        }
        System.out.println(result);
        return;
    } int N; N String[] Sn; Sn try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            Sn = new String[N];
            for (int i = 0; i < N; i++) {
                Sn[i] = sc.next();
            }
        } {
            N = sc.nextInt();
            Sn = new String[N];
            for (int i = 0; i < N; i++) {
                Sn[i] = sc.next();
            }
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) N = sc.nextInt() N sc.nextInt() sc.nextInt sc Sn = new String[N] Sn new String[N] N for (int i = 0; i < N; i++) {
                Sn[i] = sc.next();
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                Sn[i] = sc.next();
            } {
                Sn[i] = sc.next();
            } Sn[i] = sc.next() Sn[i] Sn i sc.next() sc.next sc String[] sortedChar = new String[N]; sortedChar new String[N] N for (int i = 0; i < N; i++) {
            sortedChar[i] = sortStr(Sn[i]);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            sortedChar[i] = sortStr(Sn[i]);
        } {
            sortedChar[i] = sortStr(Sn[i]);
        } sortedChar[i] = sortStr(Sn[i]) sortedChar[i] sortedChar i sortStr(Sn[i]) sortStr Sn[i] Sn i String[] sortedStr = sortStrArr(sortedChar); sortedStr sortStrArr(sortedChar) sortStrArr sortedChar long count = 1; count 1 long result = 0; result 0 for (int i = 1; i < N; i++) {
            if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            }
        } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
            if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            }
        } {
            if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            }
        } if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            } sortedStr[i].equals(sortedStr[i - 1]) sortedStr[i].equals sortedStr[i] sortedStr i sortedStr[i - 1] sortedStr i - 1 i 1 {
                count++;
            } count++ count {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            } if (count == 1) {
                    continue;
                } count == 1 count 1 {
                    continue;
                } continue; result += combi2(count) result combi2(count) combi2 count count =1 count 1 if (count > 1) {
            result += combi2(count);
        } count > 1 count 1 {
            result += combi2(count);
        } result += combi2(count) result combi2(count) combi2 count System.out.println(result) System.out.println System.out System System.out result return; String[] args args private static String sortStr(String str) {
        char[] arr = str.toCharArray();
        Arrays.sort(arr);
        return new String(arr);
    } sortStr {
        char[] arr = str.toCharArray();
        Arrays.sort(arr);
        return new String(arr);
    } char[] arr = str.toCharArray(); arr str.toCharArray() str.toCharArray str Arrays.sort(arr) Arrays.sort Arrays arr return new String(arr); new String(arr) String str str private static String[] sortStrArr(String[] strArr) {
        Arrays.sort(strArr);
        return strArr;
    } sortStrArr {
        Arrays.sort(strArr);
        return strArr;
    } Arrays.sort(strArr) Arrays.sort Arrays strArr return strArr; strArr String[] strArr strArr private static long combi2(long count) {
        return count * (count - 1) / 2;
    } combi2 {
        return count * (count - 1) / 2;
    } return count * (count - 1) / 2; count * (count - 1) / 2 count * (count - 1) count (count - 1) count 1 2 long count count public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        String[] Sn;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            Sn = new String[N];
            for (int i = 0; i < N; i++) {
                Sn[i] = sc.next();
            }
        }
        String[] sortedChar = new String[N];
        for (int i = 0; i < N; i++) {
            sortedChar[i] = sortStr(Sn[i]);
        }
        String[] sortedStr = sortStrArr(sortedChar);
        long count = 1;
        long result = 0;
        for (int i = 1; i < N; i++) {
            if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            }
        }
        if (count > 1) {
            result += combi2(count);
        }
        System.out.println(result);
        return;
    }

    private static String sortStr(String str) {
        char[] arr = str.toCharArray();
        Arrays.sort(arr);
        return new String(arr);
    }

    private static String[] sortStrArr(String[] strArr) {
        Arrays.sort(strArr);
        return strArr;
    }

    private static long combi2(long count) {
        return count * (count - 1) / 2;
    }
} public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        String[] Sn;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            Sn = new String[N];
            for (int i = 0; i < N; i++) {
                Sn[i] = sc.next();
            }
        }
        String[] sortedChar = new String[N];
        for (int i = 0; i < N; i++) {
            sortedChar[i] = sortStr(Sn[i]);
        }
        String[] sortedStr = sortStrArr(sortedChar);
        long count = 1;
        long result = 0;
        for (int i = 1; i < N; i++) {
            if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            }
        }
        if (count > 1) {
            result += combi2(count);
        }
        System.out.println(result);
        return;
    }

    private static String sortStr(String str) {
        char[] arr = str.toCharArray();
        Arrays.sort(arr);
        return new String(arr);
    }

    private static String[] sortStrArr(String[] strArr) {
        Arrays.sort(strArr);
        return strArr;
    }

    private static long combi2(long count) {
        return count * (count - 1) / 2;
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        String[] Sn;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            Sn = new String[N];
            for (int i = 0; i < N; i++) {
                Sn[i] = sc.next();
            }
        }
        String[] sortedChar = new String[N];
        for (int i = 0; i < N; i++) {
            sortedChar[i] = sortStr(Sn[i]);
        }
        String[] sortedStr = sortStrArr(sortedChar);
        long count = 1;
        long result = 0;
        for (int i = 1; i < N; i++) {
            if (sortedStr[i].equals(sortedStr[i - 1])) {
                count++;
            } else {
                if (count == 1) {
                    continue;
                }
                result += combi2(count);
                count =1;
            }
        }
        if (count > 1) {
            result += combi2(count);
        }
        System.out.println(result);
        return;
    }

    private static String sortStr(String str) {
        char[] arr = str.toCharArray();
        Arrays.sort(arr);
        return new String(arr);
    }

    private static String[] sortStrArr(String[] strArr) {
        Arrays.sort(strArr);
        return strArr;
    }

    private static long combi2(long count) {
        return count * (count - 1) / 2;
    }
}
