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
 *
 * @author silviase
 */
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);
        CGreenBin solver = new CGreenBin();
        solver.solve(1, in, out);
        out.close();
    }

    static class CGreenBin {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            String[] s = new String[n];
            for (int i = 0; i < n; i++) {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            }
            Arrays.sort(s);
            long res = 0;
            long cnt = 0;
            for (int i = 1; i < n; i++)
                res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0);

            out.println(res);

        }

    }
}
 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);
        CGreenBin solver = new CGreenBin();
        solver.solve(1, in, out);
        out.close();
    }

    static class CGreenBin {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            String[] s = new String[n];
            for (int i = 0; i < n; i++) {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            }
            Arrays.sort(s);
            long res = 0;
            long cnt = 0;
            for (int i = 1; i < n; i++)
                res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0);

            out.println(res);

        }

    }
} 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);
        CGreenBin solver = new CGreenBin();
        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);
        CGreenBin solver = new CGreenBin();
        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) CGreenBin solver = new CGreenBin(); solver new CGreenBin() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class CGreenBin {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            String[] s = new String[n];
            for (int i = 0; i < n; i++) {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            }
            Arrays.sort(s);
            long res = 0;
            long cnt = 0;
            for (int i = 1; i < n; i++)
                res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0);

            out.println(res);

        }

    } CGreenBin public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            String[] s = new String[n];
            for (int i = 0; i < n; i++) {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            }
            Arrays.sort(s);
            long res = 0;
            long cnt = 0;
            for (int i = 1; i < n; i++)
                res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0);

            out.println(res);

        } solve {

            int n = in.nextInt();
            String[] s = new String[n];
            for (int i = 0; i < n; i++) {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            }
            Arrays.sort(s);
            long res = 0;
            long cnt = 0;
            for (int i = 1; i < n; i++)
                res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0);

            out.println(res);

        } int n = in.nextInt(); n in.nextInt() in.nextInt in String[] s = new String[n]; s new String[n] n for (int i = 0; i < n; i++) {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            } {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            } char[] c = in.next().toCharArray(); c in.next().toCharArray() in.next().toCharArray in.next() in.next in Arrays.sort(c) Arrays.sort Arrays c s[i] = new String(c) s[i] s i new String(c) Arrays.sort(s) Arrays.sort Arrays s long res = 0; res 0 long cnt = 0; cnt 0 for (int i = 1; i < n; i++)
                res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0); int i = 1; int i = 1; i 1 i < n i n i++ i++ i res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0); res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0) res s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0) s[i].equals(s[i - 1]) s[i].equals s[i] s i s[i - 1] s i - 1 i 1 ++cnt cnt (cnt = 0) cnt 0 out.println(res) out.println out res 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);
        CGreenBin solver = new CGreenBin();
        solver.solve(1, in, out);
        out.close();
    }

    static class CGreenBin {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            String[] s = new String[n];
            for (int i = 0; i < n; i++) {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            }
            Arrays.sort(s);
            long res = 0;
            long cnt = 0;
            for (int i = 1; i < n; i++)
                res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0);

            out.println(res);

        }

    }
} 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);
        CGreenBin solver = new CGreenBin();
        solver.solve(1, in, out);
        out.close();
    }

    static class CGreenBin {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            String[] s = new String[n];
            for (int i = 0; i < n; i++) {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            }
            Arrays.sort(s);
            long res = 0;
            long cnt = 0;
            for (int i = 1; i < n; i++)
                res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0);

            out.println(res);

        }

    }
} 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
 *
 * @author silviase
 */
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);
        CGreenBin solver = new CGreenBin();
        solver.solve(1, in, out);
        out.close();
    }

    static class CGreenBin {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            String[] s = new String[n];
            for (int i = 0; i < n; i++) {
                char[] c = in.next().toCharArray();
                Arrays.sort(c);
                s[i] = new String(c);
            }
            Arrays.sort(s);
            long res = 0;
            long cnt = 0;
            for (int i = 1; i < n; i++)
                res += s[i].equals(s[i - 1]) ? ++cnt : (cnt = 0);

            out.println(res);

        }

    }
}

