import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
     
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
 
        char[] cline = new char[10];
        String key = "";
        long tmpCount = 0;
        long count = 0;//結果
        
        Map<String, Integer> map = new HashMap<>();

        for (int i = 0; i < N; i++) {
            tmpCount = 0;

            cline = sc.next().toCharArray();
            Arrays.sort(cline);
            key = String.valueOf(cline);
            tmpCount = map.getOrDefault(key, 0);

            count += tmpCount;

            map.put(key, (int) (tmpCount + 1));
        }
        
        System.out.println(count);
    }
} import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
 
        char[] cline = new char[10];
        String key = "";
        long tmpCount = 0;
        long count = 0;//結果
        
        Map<String, Integer> map = new HashMap<>();

        for (int i = 0; i < N; i++) {
            tmpCount = 0;

            cline = sc.next().toCharArray();
            Arrays.sort(cline);
            key = String.valueOf(cline);
            tmpCount = map.getOrDefault(key, 0);

            count += tmpCount;

            map.put(key, (int) (tmpCount + 1));
        }
        
        System.out.println(count);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
 
        char[] cline = new char[10];
        String key = "";
        long tmpCount = 0;
        long count = 0;//結果
        
        Map<String, Integer> map = new HashMap<>();

        for (int i = 0; i < N; i++) {
            tmpCount = 0;

            cline = sc.next().toCharArray();
            Arrays.sort(cline);
            key = String.valueOf(cline);
            tmpCount = map.getOrDefault(key, 0);

            count += tmpCount;

            map.put(key, (int) (tmpCount + 1));
        }
        
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
 
        char[] cline = new char[10];
        String key = "";
        long tmpCount = 0;
        long count = 0;//結果
        
        Map<String, Integer> map = new HashMap<>();

        for (int i = 0; i < N; i++) {
            tmpCount = 0;

            cline = sc.next().toCharArray();
            Arrays.sort(cline);
            key = String.valueOf(cline);
            tmpCount = map.getOrDefault(key, 0);

            count += tmpCount;

            map.put(key, (int) (tmpCount + 1));
        }
        
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc char[] cline = new char[10]; cline new char[10] 10 String key = ""; key "" long tmpCount = 0; tmpCount 0 long count = 0; count 0 Map<String, Integer> map = new HashMap<>(); map new HashMap<>() for (int i = 0; i < N; i++) {
            tmpCount = 0;

            cline = sc.next().toCharArray();
            Arrays.sort(cline);
            key = String.valueOf(cline);
            tmpCount = map.getOrDefault(key, 0);

            count += tmpCount;

            map.put(key, (int) (tmpCount + 1));
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            tmpCount = 0;

            cline = sc.next().toCharArray();
            Arrays.sort(cline);
            key = String.valueOf(cline);
            tmpCount = map.getOrDefault(key, 0);

            count += tmpCount;

            map.put(key, (int) (tmpCount + 1));
        } {
            tmpCount = 0;

            cline = sc.next().toCharArray();
            Arrays.sort(cline);
            key = String.valueOf(cline);
            tmpCount = map.getOrDefault(key, 0);

            count += tmpCount;

            map.put(key, (int) (tmpCount + 1));
        } tmpCount = 0 tmpCount 0 cline = sc.next().toCharArray() cline sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(cline) Arrays.sort Arrays cline key = String.valueOf(cline) key String.valueOf(cline) String.valueOf String cline tmpCount = map.getOrDefault(key, 0) tmpCount map.getOrDefault(key, 0) map.getOrDefault map key 0 count += tmpCount count tmpCount map.put(key, (int) (tmpCount + 1)) map.put map key (int) (tmpCount + 1) tmpCount 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
 
        char[] cline = new char[10];
        String key = "";
        long tmpCount = 0;
        long count = 0;//結果
        
        Map<String, Integer> map = new HashMap<>();

        for (int i = 0; i < N; i++) {
            tmpCount = 0;

            cline = sc.next().toCharArray();
            Arrays.sort(cline);
            key = String.valueOf(cline);
            tmpCount = map.getOrDefault(key, 0);

            count += tmpCount;

            map.put(key, (int) (tmpCount + 1));
        }
        
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
 
        char[] cline = new char[10];
        String key = "";
        long tmpCount = 0;
        long count = 0;//結果
        
        Map<String, Integer> map = new HashMap<>();

        for (int i = 0; i < N; i++) {
            tmpCount = 0;

            cline = sc.next().toCharArray();
            Arrays.sort(cline);
            key = String.valueOf(cline);
            tmpCount = map.getOrDefault(key, 0);

            count += tmpCount;

            map.put(key, (int) (tmpCount + 1));
        }
        
        System.out.println(count);
    }
} Main
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
     
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
 
        char[] cline = new char[10];
        String key = "";
        long tmpCount = 0;
        long count = 0;//結果
        
        Map<String, Integer> map = new HashMap<>();

        for (int i = 0; i < N; i++) {
            tmpCount = 0;

            cline = sc.next().toCharArray();
            Arrays.sort(cline);
            key = String.valueOf(cline);
            tmpCount = map.getOrDefault(key, 0);

            count += tmpCount;

            map.put(key, (int) (tmpCount + 1));
        }
        
        System.out.println(count);
    }
}
