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

public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] sortedWords = new String[N];
        for (int i = 0; i < N; i++) {
            String word = sc.next();
            char[] tmp = word.toCharArray();
            Arrays.sort(tmp);
            String sortedWord = String.valueOf(tmp);
            sortedWords[i] = sortedWord;
        }

        long ans = 0;
        // ここをソートしてから、同じものが並ぶ数をカウントしてみるか？
        Arrays.sort(sortedWords);
        int sameWordCount = 0;
        for (int i = 0; i <= N - 2; i++) {
            if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            }
        }
        System.out.print(ans);
    }

    long calcCombination(int n, int r) {
        if (n < 0 || r < 0) {
            throw new IllegalArgumentException("Arguments must be 0 and over.");
        }
        else if (n == r || r == 0) {
            return 1;
        }
        else if (n < r) {
            return 0;
        }
        else {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        }
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] sortedWords = new String[N];
        for (int i = 0; i < N; i++) {
            String word = sc.next();
            char[] tmp = word.toCharArray();
            Arrays.sort(tmp);
            String sortedWord = String.valueOf(tmp);
            sortedWords[i] = sortedWord;
        }

        long ans = 0;
        // ここをソートしてから、同じものが並ぶ数をカウントしてみるか？
        Arrays.sort(sortedWords);
        int sameWordCount = 0;
        for (int i = 0; i <= N - 2; i++) {
            if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            }
        }
        System.out.print(ans);
    }

    long calcCombination(int n, int r) {
        if (n < 0 || r < 0) {
            throw new IllegalArgumentException("Arguments must be 0 and over.");
        }
        else if (n == r || r == 0) {
            return 1;
        }
        else if (n < r) {
            return 0;
        }
        else {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        }
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} Main void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] sortedWords = new String[N];
        for (int i = 0; i < N; i++) {
            String word = sc.next();
            char[] tmp = word.toCharArray();
            Arrays.sort(tmp);
            String sortedWord = String.valueOf(tmp);
            sortedWords[i] = sortedWord;
        }

        long ans = 0;
        // ここをソートしてから、同じものが並ぶ数をカウントしてみるか？
        Arrays.sort(sortedWords);
        int sameWordCount = 0;
        for (int i = 0; i <= N - 2; i++) {
            if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            }
        }
        System.out.print(ans);
    } solve {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] sortedWords = new String[N];
        for (int i = 0; i < N; i++) {
            String word = sc.next();
            char[] tmp = word.toCharArray();
            Arrays.sort(tmp);
            String sortedWord = String.valueOf(tmp);
            sortedWords[i] = sortedWord;
        }

        long ans = 0;
        // ここをソートしてから、同じものが並ぶ数をカウントしてみるか？
        Arrays.sort(sortedWords);
        int sameWordCount = 0;
        for (int i = 0; i <= N - 2; i++) {
            if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            }
        }
        System.out.print(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc String[] sortedWords = new String[N]; sortedWords new String[N] N for (int i = 0; i < N; i++) {
            String word = sc.next();
            char[] tmp = word.toCharArray();
            Arrays.sort(tmp);
            String sortedWord = String.valueOf(tmp);
            sortedWords[i] = sortedWord;
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            String word = sc.next();
            char[] tmp = word.toCharArray();
            Arrays.sort(tmp);
            String sortedWord = String.valueOf(tmp);
            sortedWords[i] = sortedWord;
        } {
            String word = sc.next();
            char[] tmp = word.toCharArray();
            Arrays.sort(tmp);
            String sortedWord = String.valueOf(tmp);
            sortedWords[i] = sortedWord;
        } String word = sc.next(); word sc.next() sc.next sc char[] tmp = word.toCharArray(); tmp word.toCharArray() word.toCharArray word Arrays.sort(tmp) Arrays.sort Arrays tmp String sortedWord = String.valueOf(tmp); sortedWord String.valueOf(tmp) String.valueOf String tmp sortedWords[i] = sortedWord sortedWords[i] sortedWords i sortedWord long ans = 0; ans 0 Arrays.sort(sortedWords) Arrays.sort Arrays sortedWords int sameWordCount = 0; sameWordCount 0 for (int i = 0; i <= N - 2; i++) {
            if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            }
        } int i = 0; int i = 0; i 0 i <= N - 2 i N - 2 N 2 i++ i++ i {
            if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            }
        } {
            if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            }
        } if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            } sortedWords[i].equals(sortedWords[i + 1]) sortedWords[i].equals sortedWords[i] sortedWords i sortedWords[i + 1] sortedWords i + 1 i 1 {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            } sameWordCount++ sameWordCount if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                } i == N - 2 i N - 2 N 2 {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                } ans += calcCombination(sameWordCount + 1,2) ans calcCombination(sameWordCount + 1,2) calcCombination sameWordCount + 1 sameWordCount 1 2 break; {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            } ans += calcCombination(sameWordCount + 1,2) ans calcCombination(sameWordCount + 1,2) calcCombination sameWordCount + 1 sameWordCount 1 2 sameWordCount = 0 sameWordCount 0 System.out.print(ans) System.out.print System.out System System.out ans long calcCombination(int n, int r) {
        if (n < 0 || r < 0) {
            throw new IllegalArgumentException("Arguments must be 0 and over.");
        }
        else if (n == r || r == 0) {
            return 1;
        }
        else if (n < r) {
            return 0;
        }
        else {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        }
    } calcCombination {
        if (n < 0 || r < 0) {
            throw new IllegalArgumentException("Arguments must be 0 and over.");
        }
        else if (n == r || r == 0) {
            return 1;
        }
        else if (n < r) {
            return 0;
        }
        else {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        }
    } if (n < 0 || r < 0) {
            throw new IllegalArgumentException("Arguments must be 0 and over.");
        }
        else if (n == r || r == 0) {
            return 1;
        }
        else if (n < r) {
            return 0;
        }
        else {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        } n < 0 || r < 0 n < 0 n 0 r < 0 r 0 {
            throw new IllegalArgumentException("Arguments must be 0 and over.");
        } throw new IllegalArgumentException("Arguments must be 0 and over."); new IllegalArgumentException("Arguments must be 0 and over.") if (n == r || r == 0) {
            return 1;
        }
        else if (n < r) {
            return 0;
        }
        else {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        } n == r || r == 0 n == r n r r == 0 r 0 {
            return 1;
        } return 1; 1 if (n < r) {
            return 0;
        }
        else {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        } n < r n r {
            return 0;
        } return 0; 0 {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        } long result = 1; result 1 for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            } int i = 1; int i = 1; i 1 i <= r i r i++ i++ i {
                result = result * (n - i + 1) / i;
            } {
                result = result * (n - i + 1) / i;
            } result = result * (n - i + 1) / i result result * (n - i + 1) / i result * (n - i + 1) result (n - i + 1) n - i n i 1 i return result; result int n n int r r // Main
    public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] sortedWords = new String[N];
        for (int i = 0; i < N; i++) {
            String word = sc.next();
            char[] tmp = word.toCharArray();
            Arrays.sort(tmp);
            String sortedWord = String.valueOf(tmp);
            sortedWords[i] = sortedWord;
        }

        long ans = 0;
        // ここをソートしてから、同じものが並ぶ数をカウントしてみるか？
        Arrays.sort(sortedWords);
        int sameWordCount = 0;
        for (int i = 0; i <= N - 2; i++) {
            if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            }
        }
        System.out.print(ans);
    }

    long calcCombination(int n, int r) {
        if (n < 0 || r < 0) {
            throw new IllegalArgumentException("Arguments must be 0 and over.");
        }
        else if (n == r || r == 0) {
            return 1;
        }
        else if (n < r) {
            return 0;
        }
        else {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        }
    }

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] sortedWords = new String[N];
        for (int i = 0; i < N; i++) {
            String word = sc.next();
            char[] tmp = word.toCharArray();
            Arrays.sort(tmp);
            String sortedWord = String.valueOf(tmp);
            sortedWords[i] = sortedWord;
        }

        long ans = 0;
        // ここをソートしてから、同じものが並ぶ数をカウントしてみるか？
        Arrays.sort(sortedWords);
        int sameWordCount = 0;
        for (int i = 0; i <= N - 2; i++) {
            if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            }
        }
        System.out.print(ans);
    }

    long calcCombination(int n, int r) {
        if (n < 0 || r < 0) {
            throw new IllegalArgumentException("Arguments must be 0 and over.");
        }
        else if (n == r || r == 0) {
            return 1;
        }
        else if (n < r) {
            return 0;
        }
        else {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        }
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] sortedWords = new String[N];
        for (int i = 0; i < N; i++) {
            String word = sc.next();
            char[] tmp = word.toCharArray();
            Arrays.sort(tmp);
            String sortedWord = String.valueOf(tmp);
            sortedWords[i] = sortedWord;
        }

        long ans = 0;
        // ここをソートしてから、同じものが並ぶ数をカウントしてみるか？
        Arrays.sort(sortedWords);
        int sameWordCount = 0;
        for (int i = 0; i <= N - 2; i++) {
            if(sortedWords[i].equals(sortedWords[i + 1])) {
                sameWordCount++;
                if (i == N - 2) {
                    ans += calcCombination(sameWordCount + 1,2);
                    break;
                }
            }
            else {
                ans += calcCombination(sameWordCount + 1,2);
                sameWordCount = 0;
            }
        }
        System.out.print(ans);
    }

    long calcCombination(int n, int r) {
        if (n < 0 || r < 0) {
            throw new IllegalArgumentException("Arguments must be 0 and over.");
        }
        else if (n == r || r == 0) {
            return 1;
        }
        else if (n < r) {
            return 0;
        }
        else {
            long result = 1;
            for (int i = 1; i <= r; i++) {
                result = result * (n - i + 1) / i;
            }
            return result;
        }
    }

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