import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long count = 0;
        String[] data = new String[100011];
        for(int i=0; i<n; i++){
            String s = sc.next();
            char[] c = s.toCharArray();
            Arrays.sort(c);
            data[i] =  new String(c);
        }
        Arrays.sort(data, 0, n);
        for(int i=0; i<n; i++){
            for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            }
        }
        System.out.println(count);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long count = 0;
        String[] data = new String[100011];
        for(int i=0; i<n; i++){
            String s = sc.next();
            char[] c = s.toCharArray();
            Arrays.sort(c);
            data[i] =  new String(c);
        }
        Arrays.sort(data, 0, n);
        for(int i=0; i<n; i++){
            for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long count = 0;
        String[] data = new String[100011];
        for(int i=0; i<n; i++){
            String s = sc.next();
            char[] c = s.toCharArray();
            Arrays.sort(c);
            data[i] =  new String(c);
        }
        Arrays.sort(data, 0, n);
        for(int i=0; i<n; i++){
            for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            }
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long count = 0;
        String[] data = new String[100011];
        for(int i=0; i<n; i++){
            String s = sc.next();
            char[] c = s.toCharArray();
            Arrays.sort(c);
            data[i] =  new String(c);
        }
        Arrays.sort(data, 0, n);
        for(int i=0; i<n; i++){
            for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            }
        }
        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 long count = 0; count 0 String[] data = new String[100011]; data new String[100011] 100011 for(int i=0; i<n; i++){
            String s = sc.next();
            char[] c = s.toCharArray();
            Arrays.sort(c);
            data[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 = s.toCharArray();
            Arrays.sort(c);
            data[i] =  new String(c);
        } {
            String s = sc.next();
            char[] c = s.toCharArray();
            Arrays.sort(c);
            data[i] =  new String(c);
        } String s = sc.next(); s sc.next() sc.next sc char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s Arrays.sort(c) Arrays.sort Arrays c data[i] =  new String(c) data[i] data i new String(c) Arrays.sort(data, 0, n) Arrays.sort Arrays data 0 n for(int i=0; i<n; i++){
            for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            }
        } {
            for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            }
        } for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            } int j=i+1; int j=i+1; j i+1 i 1 j<=n j n j++ j++ j {
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            } {
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            } if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                } !(data[i].equals(data[j])) (data[i].equals(data[j])) data[i].equals data[i] data i data[j] data j {
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                } long aaa= (long) (j-i-1)*(j-i)/2; aaa (long) (j-i-1)*(j-i)/2 (long) (j-i-1)*(j-i) (long) (j-i-1) j-i-1 j i 1 (j-i) j i 2 count += aaa count aaa i=j-1 i j-1 j 1 break; 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) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long count = 0;
        String[] data = new String[100011];
        for(int i=0; i<n; i++){
            String s = sc.next();
            char[] c = s.toCharArray();
            Arrays.sort(c);
            data[i] =  new String(c);
        }
        Arrays.sort(data, 0, n);
        for(int i=0; i<n; i++){
            for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            }
        }
        System.out.println(count);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long count = 0;
        String[] data = new String[100011];
        for(int i=0; i<n; i++){
            String s = sc.next();
            char[] c = s.toCharArray();
            Arrays.sort(c);
            data[i] =  new String(c);
        }
        Arrays.sort(data, 0, n);
        for(int i=0; i<n; i++){
            for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            }
        }
        System.out.println(count);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long count = 0;
        String[] data = new String[100011];
        for(int i=0; i<n; i++){
            String s = sc.next();
            char[] c = s.toCharArray();
            Arrays.sort(c);
            data[i] =  new String(c);
        }
        Arrays.sort(data, 0, n);
        for(int i=0; i<n; i++){
            for(int j=i+1; j<=n; j++){
                if(!(data[i].equals(data[j]))){
                    long aaa= (long) (j-i-1)*(j-i)/2;
                    count += aaa;
                    i=j-1;
                    break;
                }
            }
        }
        System.out.println(count);
    }
}
