import java.util.*;

public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		
		int n=Integer.parseInt(scan.next());
		char[][]s=new char[n][10];
		String tmp;
		for (int i=0;i<n;++i) {
			tmp=scan.next();
			for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			}
		}
		for (int i=0;i<n;++i) {
			Arrays.parallelSort(s[i]);
		}
		
		String[] s_sort =new String[n];
		
		for (int i=0;i<n;++i) {
			s_sort[i]=String.valueOf(s[i]);
		}
		Arrays.parallelSort(s_sort);

		long ans=0;
		long count=1;
		for (int i=0;i<n-1;++i) {
			if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			}
		}
		if (count>1) {
			ans+=count*(count-1)/2;
		}
		
		System.out.print(ans);
		

		
}
}
//end import java.util.*; util.* java public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		
		int n=Integer.parseInt(scan.next());
		char[][]s=new char[n][10];
		String tmp;
		for (int i=0;i<n;++i) {
			tmp=scan.next();
			for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			}
		}
		for (int i=0;i<n;++i) {
			Arrays.parallelSort(s[i]);
		}
		
		String[] s_sort =new String[n];
		
		for (int i=0;i<n;++i) {
			s_sort[i]=String.valueOf(s[i]);
		}
		Arrays.parallelSort(s_sort);

		long ans=0;
		long count=1;
		for (int i=0;i<n-1;++i) {
			if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			}
		}
		if (count>1) {
			ans+=count*(count-1)/2;
		}
		
		System.out.print(ans);
		

		
}
} Main public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		
		int n=Integer.parseInt(scan.next());
		char[][]s=new char[n][10];
		String tmp;
		for (int i=0;i<n;++i) {
			tmp=scan.next();
			for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			}
		}
		for (int i=0;i<n;++i) {
			Arrays.parallelSort(s[i]);
		}
		
		String[] s_sort =new String[n];
		
		for (int i=0;i<n;++i) {
			s_sort[i]=String.valueOf(s[i]);
		}
		Arrays.parallelSort(s_sort);

		long ans=0;
		long count=1;
		for (int i=0;i<n-1;++i) {
			if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			}
		}
		if (count>1) {
			ans+=count*(count-1)/2;
		}
		
		System.out.print(ans);
		

		
} main {
		Scanner scan = new Scanner(System.in);
		
		int n=Integer.parseInt(scan.next());
		char[][]s=new char[n][10];
		String tmp;
		for (int i=0;i<n;++i) {
			tmp=scan.next();
			for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			}
		}
		for (int i=0;i<n;++i) {
			Arrays.parallelSort(s[i]);
		}
		
		String[] s_sort =new String[n];
		
		for (int i=0;i<n;++i) {
			s_sort[i]=String.valueOf(s[i]);
		}
		Arrays.parallelSort(s_sort);

		long ans=0;
		long count=1;
		for (int i=0;i<n-1;++i) {
			if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			}
		}
		if (count>1) {
			ans+=count*(count-1)/2;
		}
		
		System.out.print(ans);
		

		
} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n=Integer.parseInt(scan.next()); n Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan char[][]s=new char[n][10]; s new char[n][10] n 10 String tmp; tmp for (int i=0;i<n;++i) {
			tmp=scan.next();
			for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			}
		} int i=0; int i=0; i 0 i<n i n ++i ++i i {
			tmp=scan.next();
			for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			}
		} {
			tmp=scan.next();
			for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			}
		} tmp=scan.next() tmp scan.next() scan.next scan for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			} int k=0; int k=0; k 0 k<10 k 10 ++k ++k k {
				s[i][k]=tmp.charAt(k);
			} {
				s[i][k]=tmp.charAt(k);
			} s[i][k]=tmp.charAt(k) s[i][k] s[i] s i k tmp.charAt(k) tmp.charAt tmp k for (int i=0;i<n;++i) {
			Arrays.parallelSort(s[i]);
		} int i=0; int i=0; i 0 i<n i n ++i ++i i {
			Arrays.parallelSort(s[i]);
		} {
			Arrays.parallelSort(s[i]);
		} Arrays.parallelSort(s[i]) Arrays.parallelSort Arrays s[i] s i String[] s_sort =new String[n]; s_sort new String[n] n for (int i=0;i<n;++i) {
			s_sort[i]=String.valueOf(s[i]);
		} int i=0; int i=0; i 0 i<n i n ++i ++i i {
			s_sort[i]=String.valueOf(s[i]);
		} {
			s_sort[i]=String.valueOf(s[i]);
		} s_sort[i]=String.valueOf(s[i]) s_sort[i] s_sort i String.valueOf(s[i]) String.valueOf String s[i] s i Arrays.parallelSort(s_sort) Arrays.parallelSort Arrays s_sort long ans=0; ans 0 long count=1; count 1 for (int i=0;i<n-1;++i) {
			if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			}
		} int i=0; int i=0; i 0 i<n-1 i n-1 n 1 ++i ++i i {
			if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			}
		} {
			if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			}
		} if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			} s_sort[i].equals(s_sort[i+1]) s_sort[i].equals s_sort[i] s_sort i s_sort[i+1] s_sort i+1 i 1 { 
				++count;				
			} ++count count {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			} if (count>1) {
					ans+=count*(count-1)/2;
					
				} count>1 count 1 {
					ans+=count*(count-1)/2;
					
				} ans+=count*(count-1)/2 ans count*(count-1)/2 count*(count-1) count (count-1) count 1 2 count=1 count 1 if (count>1) {
			ans+=count*(count-1)/2;
		} count>1 count 1 {
			ans+=count*(count-1)/2;
		} ans+=count*(count-1)/2 ans count*(count-1)/2 count*(count-1) count (count-1) count 1 2 System.out.print(ans) System.out.print System.out System System.out ans String[] args args public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		
		int n=Integer.parseInt(scan.next());
		char[][]s=new char[n][10];
		String tmp;
		for (int i=0;i<n;++i) {
			tmp=scan.next();
			for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			}
		}
		for (int i=0;i<n;++i) {
			Arrays.parallelSort(s[i]);
		}
		
		String[] s_sort =new String[n];
		
		for (int i=0;i<n;++i) {
			s_sort[i]=String.valueOf(s[i]);
		}
		Arrays.parallelSort(s_sort);

		long ans=0;
		long count=1;
		for (int i=0;i<n-1;++i) {
			if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			}
		}
		if (count>1) {
			ans+=count*(count-1)/2;
		}
		
		System.out.print(ans);
		

		
}
} public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		
		int n=Integer.parseInt(scan.next());
		char[][]s=new char[n][10];
		String tmp;
		for (int i=0;i<n;++i) {
			tmp=scan.next();
			for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			}
		}
		for (int i=0;i<n;++i) {
			Arrays.parallelSort(s[i]);
		}
		
		String[] s_sort =new String[n];
		
		for (int i=0;i<n;++i) {
			s_sort[i]=String.valueOf(s[i]);
		}
		Arrays.parallelSort(s_sort);

		long ans=0;
		long count=1;
		for (int i=0;i<n-1;++i) {
			if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			}
		}
		if (count>1) {
			ans+=count*(count-1)/2;
		}
		
		System.out.print(ans);
		

		
}
} Main
import java.util.*;

public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		
		int n=Integer.parseInt(scan.next());
		char[][]s=new char[n][10];
		String tmp;
		for (int i=0;i<n;++i) {
			tmp=scan.next();
			for (int k=0;k<10;++k) {
				s[i][k]=tmp.charAt(k);
			}
		}
		for (int i=0;i<n;++i) {
			Arrays.parallelSort(s[i]);
		}
		
		String[] s_sort =new String[n];
		
		for (int i=0;i<n;++i) {
			s_sort[i]=String.valueOf(s[i]);
		}
		Arrays.parallelSort(s_sort);

		long ans=0;
		long count=1;
		for (int i=0;i<n-1;++i) {
			if (s_sort[i].equals(s_sort[i+1])) { 
				++count;				
			}else {
				if (count>1) {
					ans+=count*(count-1)/2;
					
				}count=1;

			}
		}
		if (count>1) {
			ans+=count*(count-1)/2;
		}
		
		System.out.print(ans);
		

		
}
}
//end