import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            String s[] = new String[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
            }
            char c[] = new char[10];
            for (int i = 0; i < n; i++) {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            }
            long ans = 0;
            long cnt = 0;
            Arrays.sort(s);
            String tmp = s[0];

            for (int i = 1; i < n; i++) {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            }
            // 出力
            out.println(ans);

        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            String s[] = new String[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
            }
            char c[] = new char[10];
            for (int i = 0; i < n; i++) {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            }
            long ans = 0;
            long cnt = 0;
            Arrays.sort(s);
            String tmp = s[0];

            for (int i = 1; i < n; i++) {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            }
            // 出力
            out.println(ans);

        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) C solver = new C(); solver new C() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            String s[] = new String[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
            }
            char c[] = new char[10];
            for (int i = 0; i < n; i++) {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            }
            long ans = 0;
            long cnt = 0;
            Arrays.sort(s);
            String tmp = s[0];

            for (int i = 1; i < n; i++) {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            }
            // 出力
            out.println(ans);

        }

    } C public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            String s[] = new String[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
            }
            char c[] = new char[10];
            for (int i = 0; i < n; i++) {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            }
            long ans = 0;
            long cnt = 0;
            Arrays.sort(s);
            String tmp = s[0];

            for (int i = 1; i < n; i++) {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            }
            // 出力
            out.println(ans);

        } solve {
            // 入力
            int n = Integer.parseInt(in.next());
            String s[] = new String[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
            }
            char c[] = new char[10];
            for (int i = 0; i < n; i++) {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            }
            long ans = 0;
            long cnt = 0;
            Arrays.sort(s);
            String tmp = s[0];

            for (int i = 1; i < n; i++) {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            }
            // 出力
            out.println(ans);

        } int n = Integer.parseInt(in.next()); n Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in String s[] = new String[n]; s new String[n] n for (int i = 0; i < n; i++) {
                s[i] = in.next();
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                s[i] = in.next();
            } {
                s[i] = in.next();
            } s[i] = in.next() s[i] s i in.next() in.next in char c[] = new char[10]; c new char[10] 10 for (int i = 0; i < n; i++) {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            } {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            } c = s[i].toCharArray() c s[i].toCharArray() s[i].toCharArray s[i] s i Arrays.sort(c) Arrays.sort Arrays c s[i] = String.valueOf(c) s[i] s i String.valueOf(c) String.valueOf String c long ans = 0; ans 0 long cnt = 0; cnt 0 Arrays.sort(s) Arrays.sort Arrays s String tmp = s[0]; tmp s[0] s 0 for (int i = 1; i < n; i++) {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            } {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            } if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                } tmp.equals(s[i]) tmp.equals tmp s[i] s i {
                    cnt++;
                    ans += cnt;
                } cnt++ cnt ans += cnt ans cnt {
                    cnt = 0;
                    tmp = s[i];
                } cnt = 0 cnt 0 tmp = s[i] tmp s[i] s i out.println(ans) out.println out ans int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            String s[] = new String[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
            }
            char c[] = new char[10];
            for (int i = 0; i < n; i++) {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            }
            long ans = 0;
            long cnt = 0;
            Arrays.sort(s);
            String tmp = s[0];

            for (int i = 1; i < n; i++) {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            }
            // 出力
            out.println(ans);

        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            String s[] = new String[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
            }
            char c[] = new char[10];
            for (int i = 0; i < n; i++) {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            }
            long ans = 0;
            long cnt = 0;
            Arrays.sort(s);
            String tmp = s[0];

            for (int i = 1; i < n; i++) {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            }
            // 出力
            out.println(ans);

        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            String s[] = new String[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
            }
            char c[] = new char[10];
            for (int i = 0; i < n; i++) {
                c = s[i].toCharArray();
                Arrays.sort(c);
                s[i] = String.valueOf(c);
            }
            long ans = 0;
            long cnt = 0;
            Arrays.sort(s);
            String tmp = s[0];

            for (int i = 1; i < n; i++) {
                if (tmp.equals(s[i])) {
                    cnt++;
                    ans += cnt;
                } else {
                    cnt = 0;
                    tmp = s[i];
                }
            }
            // 出力
            out.println(ans);

        }

    }
}

