import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String[] s = new String[N];
        Map<String, Integer> map = new HashMap<>();
        
        //sに格納
        String a = "";
        String S = "";
        long ans = 0;
        for(int i = 0; i < N; i++) {
            a = sc.next();
            String[] sp = a.split("");
            Arrays.sort(sp);
            for(int j = 0; j < 10; j++) {
                S += sp[j];
            }
            if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            }
            S = "";
        }
       System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String[] s = new String[N];
        Map<String, Integer> map = new HashMap<>();
        
        //sに格納
        String a = "";
        String S = "";
        long ans = 0;
        for(int i = 0; i < N; i++) {
            a = sc.next();
            String[] sp = a.split("");
            Arrays.sort(sp);
            for(int j = 0; j < 10; j++) {
                S += sp[j];
            }
            if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            }
            S = "";
        }
       System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String[] s = new String[N];
        Map<String, Integer> map = new HashMap<>();
        
        //sに格納
        String a = "";
        String S = "";
        long ans = 0;
        for(int i = 0; i < N; i++) {
            a = sc.next();
            String[] sp = a.split("");
            Arrays.sort(sp);
            for(int j = 0; j < 10; j++) {
                S += sp[j];
            }
            if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            }
            S = "";
        }
       System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String[] s = new String[N];
        Map<String, Integer> map = new HashMap<>();
        
        //sに格納
        String a = "";
        String S = "";
        long ans = 0;
        for(int i = 0; i < N; i++) {
            a = sc.next();
            String[] sp = a.split("");
            Arrays.sort(sp);
            for(int j = 0; j < 10; j++) {
                S += sp[j];
            }
            if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            }
            S = "";
        }
       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[] s = new String[N]; s new String[N] N Map<String, Integer> map = new HashMap<>(); map new HashMap<>() String a = ""; a "" String S = ""; S "" long ans = 0; ans 0 for(int i = 0; i < N; i++) {
            a = sc.next();
            String[] sp = a.split("");
            Arrays.sort(sp);
            for(int j = 0; j < 10; j++) {
                S += sp[j];
            }
            if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            }
            S = "";
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            a = sc.next();
            String[] sp = a.split("");
            Arrays.sort(sp);
            for(int j = 0; j < 10; j++) {
                S += sp[j];
            }
            if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            }
            S = "";
        } {
            a = sc.next();
            String[] sp = a.split("");
            Arrays.sort(sp);
            for(int j = 0; j < 10; j++) {
                S += sp[j];
            }
            if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            }
            S = "";
        } a = sc.next() a sc.next() sc.next sc String[] sp = a.split(""); sp a.split("") a.split a "" Arrays.sort(sp) Arrays.sort Arrays sp for(int j = 0; j < 10; j++) {
                S += sp[j];
            } int j = 0; int j = 0; j 0 j < 10 j 10 j++ j++ j {
                S += sp[j];
            } {
                S += sp[j];
            } S += sp[j] S sp[j] sp j if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            } map.containsKey(S) map.containsKey map S {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            } ans += map.get(S) ans map.get(S) map.get map S map.put(S, map.get(S) + 1) map.put map S map.get(S) + 1 map.get(S) map.get map S 1 {
                map.put(S, 1);
            } map.put(S, 1) map.put map S 1 S = "" S "" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String[] s = new String[N];
        Map<String, Integer> map = new HashMap<>();
        
        //sに格納
        String a = "";
        String S = "";
        long ans = 0;
        for(int i = 0; i < N; i++) {
            a = sc.next();
            String[] sp = a.split("");
            Arrays.sort(sp);
            for(int j = 0; j < 10; j++) {
                S += sp[j];
            }
            if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            }
            S = "";
        }
       System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String[] s = new String[N];
        Map<String, Integer> map = new HashMap<>();
        
        //sに格納
        String a = "";
        String S = "";
        long ans = 0;
        for(int i = 0; i < N; i++) {
            a = sc.next();
            String[] sp = a.split("");
            Arrays.sort(sp);
            for(int j = 0; j < 10; j++) {
                S += sp[j];
            }
            if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            }
            S = "";
        }
       System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String[] s = new String[N];
        Map<String, Integer> map = new HashMap<>();
        
        //sに格納
        String a = "";
        String S = "";
        long ans = 0;
        for(int i = 0; i < N; i++) {
            a = sc.next();
            String[] sp = a.split("");
            Arrays.sort(sp);
            for(int j = 0; j < 10; j++) {
                S += sp[j];
            }
            if(map.containsKey(S)) {
                ans += map.get(S);
                map.put(S, map.get(S) + 1);
            }else {
                map.put(S, 1);
            }
            S = "";
        }
       System.out.println(ans);
    }
}