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

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String[] ar = new String[n];
        for (int i = 0; i < n; i++) {
            char[] v = scan.next().toCharArray();
            Arrays.sort(v);
            ar[i] = new String(v);
        }

        Arrays.sort(ar);
        long cnt = 0;
        long sum = 0;
        for (int i = 1; i < ar.length; i++) {
            if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            }
        }

        System.out.println(sum);
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String[] ar = new String[n];
        for (int i = 0; i < n; i++) {
            char[] v = scan.next().toCharArray();
            Arrays.sort(v);
            ar[i] = new String(v);
        }

        Arrays.sort(ar);
        long cnt = 0;
        long sum = 0;
        for (int i = 1; i < ar.length; i++) {
            if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            }
        }

        System.out.println(sum);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String[] ar = new String[n];
        for (int i = 0; i < n; i++) {
            char[] v = scan.next().toCharArray();
            Arrays.sort(v);
            ar[i] = new String(v);
        }

        Arrays.sort(ar);
        long cnt = 0;
        long sum = 0;
        for (int i = 1; i < ar.length; i++) {
            if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            }
        }

        System.out.println(sum);
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String[] ar = new String[n];
        for (int i = 0; i < n; i++) {
            char[] v = scan.next().toCharArray();
            Arrays.sort(v);
            ar[i] = new String(v);
        }

        Arrays.sort(ar);
        long cnt = 0;
        long sum = 0;
        for (int i = 1; i < ar.length; i++) {
            if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            }
        }

        System.out.println(sum);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan String[] ar = new String[n]; ar new String[n] n for (int i = 0; i < n; i++) {
            char[] v = scan.next().toCharArray();
            Arrays.sort(v);
            ar[i] = new String(v);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            char[] v = scan.next().toCharArray();
            Arrays.sort(v);
            ar[i] = new String(v);
        } {
            char[] v = scan.next().toCharArray();
            Arrays.sort(v);
            ar[i] = new String(v);
        } char[] v = scan.next().toCharArray(); v scan.next().toCharArray() scan.next().toCharArray scan.next() scan.next scan Arrays.sort(v) Arrays.sort Arrays v ar[i] = new String(v) ar[i] ar i new String(v) Arrays.sort(ar) Arrays.sort Arrays ar long cnt = 0; cnt 0 long sum = 0; sum 0 for (int i = 1; i < ar.length; i++) {
            if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            }
        } int i = 1; int i = 1; i 1 i < ar.length i ar.length ar ar.length i++ i++ i {
            if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            }
        } {
            if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            }
        } if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            } ar[i].equals(ar[i-1]) ar[i].equals ar[i] ar i ar[i-1] ar i-1 i 1 {
                cnt++;
                sum+=cnt;
            } cnt++ cnt sum+=cnt sum cnt {
                cnt = 0;
            } cnt = 0 cnt 0 System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String[] ar = new String[n];
        for (int i = 0; i < n; i++) {
            char[] v = scan.next().toCharArray();
            Arrays.sort(v);
            ar[i] = new String(v);
        }

        Arrays.sort(ar);
        long cnt = 0;
        long sum = 0;
        for (int i = 1; i < ar.length; i++) {
            if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            }
        }

        System.out.println(sum);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String[] ar = new String[n];
        for (int i = 0; i < n; i++) {
            char[] v = scan.next().toCharArray();
            Arrays.sort(v);
            ar[i] = new String(v);
        }

        Arrays.sort(ar);
        long cnt = 0;
        long sum = 0;
        for (int i = 1; i < ar.length; i++) {
            if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            }
        }

        System.out.println(sum);
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String[] ar = new String[n];
        for (int i = 0; i < n; i++) {
            char[] v = scan.next().toCharArray();
            Arrays.sort(v);
            ar[i] = new String(v);
        }

        Arrays.sort(ar);
        long cnt = 0;
        long sum = 0;
        for (int i = 1; i < ar.length; i++) {
            if(ar[i].equals(ar[i-1])){
                cnt++;
                sum+=cnt;
            }else{
                cnt = 0;
            }
        }

        System.out.println(sum);
    }
}
