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

public class Main{

	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String[] line=new String[n];
		char s[][]=new char[n][10];

		for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i=0;i<n;i++){
			line[i]=String.valueOf(s[i]);
		}

		int count=0;
		long usagi=0;


		Arrays.sort(line);


		for(int i=0;i<n-1;i++){
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		}


		System.out.println(usagi);

	}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main{

	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String[] line=new String[n];
		char s[][]=new char[n][10];

		for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i=0;i<n;i++){
			line[i]=String.valueOf(s[i]);
		}

		int count=0;
		long usagi=0;


		Arrays.sort(line);


		for(int i=0;i<n-1;i++){
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		}


		System.out.println(usagi);

	}
} Main public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String[] line=new String[n];
		char s[][]=new char[n][10];

		for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i=0;i<n;i++){
			line[i]=String.valueOf(s[i]);
		}

		int count=0;
		long usagi=0;


		Arrays.sort(line);


		for(int i=0;i<n-1;i++){
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		}


		System.out.println(usagi);

	} main {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String[] line=new String[n];
		char s[][]=new char[n][10];

		for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i=0;i<n;i++){
			line[i]=String.valueOf(s[i]);
		}

		int count=0;
		long usagi=0;


		Arrays.sort(line);


		for(int i=0;i<n-1;i++){
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		}


		System.out.println(usagi);

	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc String[] line=new String[n]; line new String[n] n char s[][]=new char[n][10]; s new char[n][10] n 10 for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		} {
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		} s[i]=sc.next().toCharArray() s[i] s i sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(s[i]) Arrays.sort Arrays s[i] s i for(int i=0;i<n;i++){
			line[i]=String.valueOf(s[i]);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			line[i]=String.valueOf(s[i]);
		} {
			line[i]=String.valueOf(s[i]);
		} line[i]=String.valueOf(s[i]) line[i] line i String.valueOf(s[i]) String.valueOf String s[i] s i int count=0; count 0 long usagi=0; usagi 0 Arrays.sort(line) Arrays.sort Arrays line for(int i=0;i<n-1;i++){
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		} int i=0; int i=0; i 0 i<n-1 i n-1 n 1 i++ i++ i {
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		} {
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		} if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			} line[i].equals(line[i+1]) line[i].equals line[i] line i line[i+1] line i+1 i 1 {
				count++;
				usagi+=count;
			} count++ count usagi+=count usagi count {
				count=0;
			} count=0 count 0 System.out.println(usagi) System.out.println System.out System System.out usagi String[]args args public class Main{

	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String[] line=new String[n];
		char s[][]=new char[n][10];

		for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i=0;i<n;i++){
			line[i]=String.valueOf(s[i]);
		}

		int count=0;
		long usagi=0;


		Arrays.sort(line);


		for(int i=0;i<n-1;i++){
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		}


		System.out.println(usagi);

	}
} public class Main{

	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String[] line=new String[n];
		char s[][]=new char[n][10];

		for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i=0;i<n;i++){
			line[i]=String.valueOf(s[i]);
		}

		int count=0;
		long usagi=0;


		Arrays.sort(line);


		for(int i=0;i<n-1;i++){
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		}


		System.out.println(usagi);

	}
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main{

	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String[] line=new String[n];
		char s[][]=new char[n][10];

		for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i=0;i<n;i++){
			line[i]=String.valueOf(s[i]);
		}

		int count=0;
		long usagi=0;


		Arrays.sort(line);


		for(int i=0;i<n-1;i++){
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		}


		System.out.println(usagi);

	}
}
