import java.util.*;

public class Main{

    public static void main(String args[]){

        Scanner scan = new Scanner(System.in);
        Integer N = scan.nextInt();
        ArrayList<String> str = new ArrayList<String>();

        for(int i=0;i<N;i++){
            String s = strSort(scan.next());
            str.add(s);
        }

        Collections.sort(str);

        //for(int i=0;i<N;i++) System.out.println(str.get(i));

        long sum = 0;
        for(int i=0;i<N-1;i++){
            if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            }
        }

        System.out.println(sum);

    }

    static long calcCombination( int n, int m ) {
        if( n < m || m < 0 ) {
            return 0;
        }
        long c = 1;
        m = ( n - m < m ? n - m : m );
        for( int ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++ ) {
            c *= ns;
            c /= ms;
        }
        return c;
    }

    static long calcNumOfCombination(long n, long r){
        return factorial(n) / (factorial(r) * factorial(n-r));
    }
    static long factorial(long n){
        long answer = 1;
	while(n > 1){
	    answer *= n;
	    n--;
	}
        return answer;
    }

    public static String strSort(String str){
        char[] c = str.toCharArray();
        Arrays.sort(c);
        return new String(c);        
    }
} import java.util.*; util.* java public class Main{

    public static void main(String args[]){

        Scanner scan = new Scanner(System.in);
        Integer N = scan.nextInt();
        ArrayList<String> str = new ArrayList<String>();

        for(int i=0;i<N;i++){
            String s = strSort(scan.next());
            str.add(s);
        }

        Collections.sort(str);

        //for(int i=0;i<N;i++) System.out.println(str.get(i));

        long sum = 0;
        for(int i=0;i<N-1;i++){
            if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            }
        }

        System.out.println(sum);

    }

    static long calcCombination( int n, int m ) {
        if( n < m || m < 0 ) {
            return 0;
        }
        long c = 1;
        m = ( n - m < m ? n - m : m );
        for( int ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++ ) {
            c *= ns;
            c /= ms;
        }
        return c;
    }

    static long calcNumOfCombination(long n, long r){
        return factorial(n) / (factorial(r) * factorial(n-r));
    }
    static long factorial(long n){
        long answer = 1;
	while(n > 1){
	    answer *= n;
	    n--;
	}
        return answer;
    }

    public static String strSort(String str){
        char[] c = str.toCharArray();
        Arrays.sort(c);
        return new String(c);        
    }
} Main public static void main(String args[]){

        Scanner scan = new Scanner(System.in);
        Integer N = scan.nextInt();
        ArrayList<String> str = new ArrayList<String>();

        for(int i=0;i<N;i++){
            String s = strSort(scan.next());
            str.add(s);
        }

        Collections.sort(str);

        //for(int i=0;i<N;i++) System.out.println(str.get(i));

        long sum = 0;
        for(int i=0;i<N-1;i++){
            if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            }
        }

        System.out.println(sum);

    } main {

        Scanner scan = new Scanner(System.in);
        Integer N = scan.nextInt();
        ArrayList<String> str = new ArrayList<String>();

        for(int i=0;i<N;i++){
            String s = strSort(scan.next());
            str.add(s);
        }

        Collections.sort(str);

        //for(int i=0;i<N;i++) System.out.println(str.get(i));

        long sum = 0;
        for(int i=0;i<N-1;i++){
            if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            }
        }

        System.out.println(sum);

    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) Integer N = scan.nextInt(); N scan.nextInt() scan.nextInt scan ArrayList<String> str = new ArrayList<String>(); str new ArrayList<String>() for(int i=0;i<N;i++){
            String s = strSort(scan.next());
            str.add(s);
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            String s = strSort(scan.next());
            str.add(s);
        } {
            String s = strSort(scan.next());
            str.add(s);
        } String s = strSort(scan.next()); s strSort(scan.next()) strSort scan.next() scan.next scan str.add(s) str.add str s Collections.sort(str) Collections.sort Collections str long sum = 0; sum 0 for(int i=0;i<N-1;i++){
            if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            }
        } int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
            if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            }
        } {
            if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            }
        } if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            } str.get(i).equals(str.get(i+1)) str.get(i).equals str.get(i) str.get str i str.get(i+1) str.get str i+1 i 1 {
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            } int counter = i; counter i int num = 1; num 1 while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                } true {
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                } if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    } counter<N-1 counter N-1 N 1 {
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    } if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        } str.get(counter).equals(str.get(counter+1)) str.get(counter).equals str.get(counter) str.get str counter str.get(counter+1) str.get str counter+1 counter 1 {
                            num++;
                            counter++;
                        } num++ num counter++ counter {
                            break;
                        } break; {
                        break;
                    } break; sum += calcCombination(num, 2) sum calcCombination(num, 2) calcCombination num 2 i=counter i counter System.out.println(sum) System.out.println System.out System System.out sum String args[] args static long calcCombination( int n, int m ) {
        if( n < m || m < 0 ) {
            return 0;
        }
        long c = 1;
        m = ( n - m < m ? n - m : m );
        for( int ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++ ) {
            c *= ns;
            c /= ms;
        }
        return c;
    } calcCombination {
        if( n < m || m < 0 ) {
            return 0;
        }
        long c = 1;
        m = ( n - m < m ? n - m : m );
        for( int ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++ ) {
            c *= ns;
            c /= ms;
        }
        return c;
    } if( n < m || m < 0 ) {
            return 0;
        } n < m || m < 0 n < m n m m < 0 m 0 {
            return 0;
        } return 0; 0 long c = 1; c 1 m = ( n - m < m ? n - m : m ) m ( n - m < m ? n - m : m ) n - m < m n - m n m m n - m n m m for( int ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++ ) {
            c *= ns;
            c /= ms;
        } int ns = n - m + 1, ms = 1; int ns = n - m + 1 ns n - m + 1 n - m n m 1 ms = 1; ms 1 ms <= m ms m ns ++, ms ++ ns ++ ns ms ++ ms {
            c *= ns;
            c /= ms;
        } {
            c *= ns;
            c /= ms;
        } c *= ns c ns c /= ms c ms return c; c int n n int m m static long calcNumOfCombination(long n, long r){
        return factorial(n) / (factorial(r) * factorial(n-r));
    } calcNumOfCombination {
        return factorial(n) / (factorial(r) * factorial(n-r));
    } return factorial(n) / (factorial(r) * factorial(n-r)); factorial(n) / (factorial(r) * factorial(n-r)) factorial(n) factorial n (factorial(r) * factorial(n-r)) factorial(r) factorial r factorial(n-r) factorial n-r n r long n n long r r static long factorial(long n){
        long answer = 1;
	while(n > 1){
	    answer *= n;
	    n--;
	}
        return answer;
    } factorial {
        long answer = 1;
	while(n > 1){
	    answer *= n;
	    n--;
	}
        return answer;
    } long answer = 1; answer 1 while(n > 1){
	    answer *= n;
	    n--;
	} n > 1 n 1 {
	    answer *= n;
	    n--;
	} answer *= n answer n n-- n return answer; answer long n n public static String strSort(String str){
        char[] c = str.toCharArray();
        Arrays.sort(c);
        return new String(c);        
    } strSort {
        char[] c = str.toCharArray();
        Arrays.sort(c);
        return new String(c);        
    } char[] c = str.toCharArray(); c str.toCharArray() str.toCharArray str Arrays.sort(c) Arrays.sort Arrays c return new String(c); new String(c) String str str public class Main{

    public static void main(String args[]){

        Scanner scan = new Scanner(System.in);
        Integer N = scan.nextInt();
        ArrayList<String> str = new ArrayList<String>();

        for(int i=0;i<N;i++){
            String s = strSort(scan.next());
            str.add(s);
        }

        Collections.sort(str);

        //for(int i=0;i<N;i++) System.out.println(str.get(i));

        long sum = 0;
        for(int i=0;i<N-1;i++){
            if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            }
        }

        System.out.println(sum);

    }

    static long calcCombination( int n, int m ) {
        if( n < m || m < 0 ) {
            return 0;
        }
        long c = 1;
        m = ( n - m < m ? n - m : m );
        for( int ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++ ) {
            c *= ns;
            c /= ms;
        }
        return c;
    }

    static long calcNumOfCombination(long n, long r){
        return factorial(n) / (factorial(r) * factorial(n-r));
    }
    static long factorial(long n){
        long answer = 1;
	while(n > 1){
	    answer *= n;
	    n--;
	}
        return answer;
    }

    public static String strSort(String str){
        char[] c = str.toCharArray();
        Arrays.sort(c);
        return new String(c);        
    }
} public class Main{

    public static void main(String args[]){

        Scanner scan = new Scanner(System.in);
        Integer N = scan.nextInt();
        ArrayList<String> str = new ArrayList<String>();

        for(int i=0;i<N;i++){
            String s = strSort(scan.next());
            str.add(s);
        }

        Collections.sort(str);

        //for(int i=0;i<N;i++) System.out.println(str.get(i));

        long sum = 0;
        for(int i=0;i<N-1;i++){
            if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            }
        }

        System.out.println(sum);

    }

    static long calcCombination( int n, int m ) {
        if( n < m || m < 0 ) {
            return 0;
        }
        long c = 1;
        m = ( n - m < m ? n - m : m );
        for( int ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++ ) {
            c *= ns;
            c /= ms;
        }
        return c;
    }

    static long calcNumOfCombination(long n, long r){
        return factorial(n) / (factorial(r) * factorial(n-r));
    }
    static long factorial(long n){
        long answer = 1;
	while(n > 1){
	    answer *= n;
	    n--;
	}
        return answer;
    }

    public static String strSort(String str){
        char[] c = str.toCharArray();
        Arrays.sort(c);
        return new String(c);        
    }
} Main
import java.util.*;

public class Main{

    public static void main(String args[]){

        Scanner scan = new Scanner(System.in);
        Integer N = scan.nextInt();
        ArrayList<String> str = new ArrayList<String>();

        for(int i=0;i<N;i++){
            String s = strSort(scan.next());
            str.add(s);
        }

        Collections.sort(str);

        //for(int i=0;i<N;i++) System.out.println(str.get(i));

        long sum = 0;
        for(int i=0;i<N-1;i++){
            if(str.get(i).equals(str.get(i+1))){
                int counter = i;
                int num = 1;
                while(true){
                    //System.out.println("count");

                    if(counter<N-1){
                        if(str.get(counter).equals(str.get(counter+1))){
                            num++;
                            counter++;
                        }else{
                            break;
                        }
                    }else{
                        break;
                    }
                }             
                //System.out.println("num:" + num);   
                sum += calcCombination(num, 2);
                //System.out.println(sum);
                i=counter;
            }
        }

        System.out.println(sum);

    }

    static long calcCombination( int n, int m ) {
        if( n < m || m < 0 ) {
            return 0;
        }
        long c = 1;
        m = ( n - m < m ? n - m : m );
        for( int ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++ ) {
            c *= ns;
            c /= ms;
        }
        return c;
    }

    static long calcNumOfCombination(long n, long r){
        return factorial(n) / (factorial(r) * factorial(n-r));
    }
    static long factorial(long n){
        long answer = 1;
	while(n > 1){
	    answer *= n;
	    n--;
	}
        return answer;
    }

    public static String strSort(String str){
        char[] c = str.toCharArray();
        Arrays.sort(c);
        return new String(c);        
    }
}
