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

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

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        long count = 0;
        String words[] = new String[n];
        
        for(int i = 0; i < n; i++){
            String s = stdIn.next();
            char c[] = s.toCharArray();
            Arrays.sort(c);
            words[i] = String.valueOf(c);
        }
        
        Arrays.sort(words);
        
        for(int i = 0; i < n - 1; i++){
            int num = 0;
            for(int j = i + 1; j < n; j++){
                if(words[i].equals(words[j])){
                    count++;
                    num++;
                }else{
                    break;
                }
            }
            
            if(num != 0){
                for(int j = num - 1; j >= 1; j--){
                    count = count +  j; 
                }
                i += num;
            }
        }
        
        System.out.println(count);
    }
}
