import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	
	public static String sort( String str ){
		String r = "";
		for( char i = 'a'; i <= 'z'; i++ ){
			for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			}
		}
		return r;
	}
	
	
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] s = new String[N];
        Map<String, Integer> myMap = new HashMap<String, Integer>();
        
        long cnt = 0;
        for( int i = 0; i < N; i++ ){
        	s[i] = sc.next();
        	s[i] = sort(s[i]);
        	if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	}
        }
        
        
        System.out.println( cnt );
        
        sc.close();
    }
} import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {
	
	public static String sort( String str ){
		String r = "";
		for( char i = 'a'; i <= 'z'; i++ ){
			for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			}
		}
		return r;
	}
	
	
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] s = new String[N];
        Map<String, Integer> myMap = new HashMap<String, Integer>();
        
        long cnt = 0;
        for( int i = 0; i < N; i++ ){
        	s[i] = sc.next();
        	s[i] = sort(s[i]);
        	if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	}
        }
        
        
        System.out.println( cnt );
        
        sc.close();
    }
} Main public static String sort( String str ){
		String r = "";
		for( char i = 'a'; i <= 'z'; i++ ){
			for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			}
		}
		return r;
	} sort {
		String r = "";
		for( char i = 'a'; i <= 'z'; i++ ){
			for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			}
		}
		return r;
	} String r = ""; r "" for( char i = 'a'; i <= 'z'; i++ ){
			for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			}
		} char i = 'a'; char i = 'a'; i 'a' i <= 'z' i 'z' i++ i++ i {
			for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			}
		} {
			for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			}
		} for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			} int j = 0; int j = 0; j 0 j < str.length() j str.length() str.length str j++ j++ j {
				if( i == str.charAt(j) ){
					r += i;
				}
			} {
				if( i == str.charAt(j) ){
					r += i;
				}
			} if( i == str.charAt(j) ){
					r += i;
				} i == str.charAt(j) i str.charAt(j) str.charAt str j {
					r += i;
				} r += i r i return r; r String str str public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] s = new String[N];
        Map<String, Integer> myMap = new HashMap<String, Integer>();
        
        long cnt = 0;
        for( int i = 0; i < N; i++ ){
        	s[i] = sc.next();
        	s[i] = sort(s[i]);
        	if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	}
        }
        
        
        System.out.println( cnt );
        
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] s = new String[N];
        Map<String, Integer> myMap = new HashMap<String, Integer>();
        
        long cnt = 0;
        for( int i = 0; i < N; i++ ){
        	s[i] = sc.next();
        	s[i] = sort(s[i]);
        	if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	}
        }
        
        
        System.out.println( cnt );
        
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc String[] s = new String[N]; s new String[N] N Map<String, Integer> myMap = new HashMap<String, Integer>(); myMap new HashMap<String, Integer>() long cnt = 0; cnt 0 for( int i = 0; i < N; i++ ){
        	s[i] = sc.next();
        	s[i] = sort(s[i]);
        	if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	}
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
        	s[i] = sc.next();
        	s[i] = sort(s[i]);
        	if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	}
        } {
        	s[i] = sc.next();
        	s[i] = sort(s[i]);
        	if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	}
        } s[i] = sc.next() s[i] s i sc.next() sc.next sc s[i] = sort(s[i]) s[i] s i sort(s[i]) sort s[i] s i if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	} myMap.containsKey(s[i]) myMap.containsKey myMap s[i] s i {
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	} int value = myMap.get(s[i]); value myMap.get(s[i]) myMap.get myMap s[i] s i cnt += value cnt value myMap.put(s[i],value+1 ) myMap.put myMap s[i] s i value+1 value 1 {
        		myMap.put(s[i], 1);
        	} myMap.put(s[i], 1) myMap.put myMap s[i] s i 1 System.out.println( cnt ) System.out.println System.out System System.out cnt sc.close() sc.close sc String[] args args public class Main {
	
	public static String sort( String str ){
		String r = "";
		for( char i = 'a'; i <= 'z'; i++ ){
			for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			}
		}
		return r;
	}
	
	
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] s = new String[N];
        Map<String, Integer> myMap = new HashMap<String, Integer>();
        
        long cnt = 0;
        for( int i = 0; i < N; i++ ){
        	s[i] = sc.next();
        	s[i] = sort(s[i]);
        	if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	}
        }
        
        
        System.out.println( cnt );
        
        sc.close();
    }
} public class Main {
	
	public static String sort( String str ){
		String r = "";
		for( char i = 'a'; i <= 'z'; i++ ){
			for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			}
		}
		return r;
	}
	
	
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] s = new String[N];
        Map<String, Integer> myMap = new HashMap<String, Integer>();
        
        long cnt = 0;
        for( int i = 0; i < N; i++ ){
        	s[i] = sc.next();
        	s[i] = sort(s[i]);
        	if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	}
        }
        
        
        System.out.println( cnt );
        
        sc.close();
    }
} Main
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	
	public static String sort( String str ){
		String r = "";
		for( char i = 'a'; i <= 'z'; i++ ){
			for( int j = 0; j < str.length(); j++ ){
				if( i == str.charAt(j) ){
					r += i;
				}
			}
		}
		return r;
	}
	
	
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] s = new String[N];
        Map<String, Integer> myMap = new HashMap<String, Integer>();
        
        long cnt = 0;
        for( int i = 0; i < N; i++ ){
        	s[i] = sc.next();
        	s[i] = sort(s[i]);
        	if( myMap.containsKey(s[i]) ){
        		int value = myMap.get(s[i]);
        		cnt += value;
        		myMap.put(s[i],value+1 );
        	}
        	else{
        		myMap.put(s[i], 1);
        	}
        }
        
        
        System.out.println( cnt );
        
        sc.close();
    }
}