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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] ary = new String[n];
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            char[] c = new char[10];
            c = s.toCharArray();
            Arrays.sort(c);
            ary[i] = new String(c);
        }
        Arrays.sort(ary);
        long ans = 0L;
        long cnt = 0L;
        s:for (int i = 0; i < n; i++) {
            if (i == n - 1) {
                if (cnt != 0) {
                    ans += calc(cnt);
                }
            } else {
                if (ary[i].equals(ary[i + 1])) {
                    cnt++;
                } else if (cnt != 0){
                    ans += calc(cnt);
                    cnt = 0;
                }
            }
        }
        System.out.println(ans);
    }

    public static long calc(long l) {
        if (l == 0) {
            return 0;
        } else {
            return l + calc(l - 1);
        }
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] ary = new String[n];
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            char[] c = new char[10];
            c = s.toCharArray();
            Arrays.sort(c);
            ary[i] = new String(c);
        }
        Arrays.sort(ary);
        long ans = 0L;
        long cnt = 0L;
        s:for (int i = 0; i < n; i++) {
            if (i == n - 1) {
                if (cnt != 0) {
                    ans += calc(cnt);
                }
            } else {
                if (ary[i].equals(ary[i + 1])) {
                    cnt++;
                } else if (cnt != 0){
                    ans += calc(cnt);
                    cnt = 0;
                }
            }
        }
        System.out.println(ans);
    }

    public static long calc(long l) {
        if (l == 0) {
            return 0;
        } else {
            return l + calc(l - 1);
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] ary = new String[n];
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            char[] c = new char[10];
            c = s.toCharArray();
            Arrays.sort(c);
            ary[i] = new String(c);
        }
        Arrays.sort(ary);
        long ans = 0L;
        long cnt = 0L;
        s:for (int i = 0; i < n; i++) {
            if (i == n - 1) {
                if (cnt != 0) {
                    ans += calc(cnt);
                }
            } else {
                if (ary[i].equals(ary[i + 1])) {
                    cnt++;
                } else if (cnt != 0){
                    ans += calc(cnt);
                    cnt = 0;
                }
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] ary = new String[n];
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            char[] c = new char[10];
            c = s.toCharArray();
            Arrays.sort(c);
            ary[i] = new String(c);
        }
        Arrays.sort(ary);
        long ans = 0L;
        long cnt = 0L;
        s:for (int i = 0; i < n; i++) {
            if (i == n - 1) {
                if (cnt != 0) {
                    ans += calc(cnt);
                }
            } else {
                if (ary[i].equals(ary[i + 1])) {
                    cnt++;
                } else if (cnt != 0){
                    ans += calc(cnt);
                    cnt = 0;
                }
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc String[] ary = new String[n]; ary new String[n] n for (int i = 0; i < n; i++) {
            String s = sc.next();
            char[] c = new char[10];
            c = s.toCharArray();
            Arrays.sort(c);
            ary[i] = new String(c);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String s = sc.next();
            char[] c = new char[10];
            c = s.toCharArray();
            Arrays.sort(c);
            ary[i] = new String(c);
        } {
            String s = sc.next();
            char[] c = new char[10];
            c = s.toCharArray();
            Arrays.sort(c);
            ary[i] = new String(c);
        } String s = sc.next(); s sc.next() sc.next sc char[] c = new char[10]; c new char[10] 10 c = s.toCharArray() c s.toCharArray() s.toCharArray s Arrays.sort(c) Arrays.sort Arrays c ary[i] = new String(c) ary[i] ary i new String(c) Arrays.sort(ary) Arrays.sort Arrays ary long ans = 0L; ans 0L long cnt = 0L; cnt 0L System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static long calc(long l) {
        if (l == 0) {
            return 0;
        } else {
            return l + calc(l - 1);
        }
    } calc {
        if (l == 0) {
            return 0;
        } else {
            return l + calc(l - 1);
        }
    } if (l == 0) {
            return 0;
        } else {
            return l + calc(l - 1);
        } l == 0 l 0 {
            return 0;
        } return 0; 0 {
            return l + calc(l - 1);
        } return l + calc(l - 1); l + calc(l - 1) l calc(l - 1) calc l - 1 l 1 long l l public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] ary = new String[n];
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            char[] c = new char[10];
            c = s.toCharArray();
            Arrays.sort(c);
            ary[i] = new String(c);
        }
        Arrays.sort(ary);
        long ans = 0L;
        long cnt = 0L;
        s:for (int i = 0; i < n; i++) {
            if (i == n - 1) {
                if (cnt != 0) {
                    ans += calc(cnt);
                }
            } else {
                if (ary[i].equals(ary[i + 1])) {
                    cnt++;
                } else if (cnt != 0){
                    ans += calc(cnt);
                    cnt = 0;
                }
            }
        }
        System.out.println(ans);
    }

    public static long calc(long l) {
        if (l == 0) {
            return 0;
        } else {
            return l + calc(l - 1);
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] ary = new String[n];
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            char[] c = new char[10];
            c = s.toCharArray();
            Arrays.sort(c);
            ary[i] = new String(c);
        }
        Arrays.sort(ary);
        long ans = 0L;
        long cnt = 0L;
        s:for (int i = 0; i < n; i++) {
            if (i == n - 1) {
                if (cnt != 0) {
                    ans += calc(cnt);
                }
            } else {
                if (ary[i].equals(ary[i + 1])) {
                    cnt++;
                } else if (cnt != 0){
                    ans += calc(cnt);
                    cnt = 0;
                }
            }
        }
        System.out.println(ans);
    }

    public static long calc(long l) {
        if (l == 0) {
            return 0;
        } else {
            return l + calc(l - 1);
        }
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] ary = new String[n];
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            char[] c = new char[10];
            c = s.toCharArray();
            Arrays.sort(c);
            ary[i] = new String(c);
        }
        Arrays.sort(ary);
        long ans = 0L;
        long cnt = 0L;
        s:for (int i = 0; i < n; i++) {
            if (i == n - 1) {
                if (cnt != 0) {
                    ans += calc(cnt);
                }
            } else {
                if (ary[i].equals(ary[i + 1])) {
                    cnt++;
                } else if (cnt != 0){
                    ans += calc(cnt);
                    cnt = 0;
                }
            }
        }
        System.out.println(ans);
    }

    public static long calc(long l) {
        if (l == 0) {
            return 0;
        } else {
            return l + calc(l - 1);
        }
    }
}