import java.io.*; 
import java.math.*;
import java.util.*;
import java.awt.Point;
 
public class Main {
	//static final long MOD = 998244353;
	static final long MOD = 1000000007;
	static final int INF = 1000000007;
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.ni();
		ArrayList<String> anagrams = new ArrayList<String>(N);
		for (int i = 0; i < N; i++) {
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			StringBuilder converted = new StringBuilder();
			for (char c: s)
				converted.append(c);
			anagrams.add(converted.toString());
		}

		Collections.sort(anagrams);

		long ans = 0;
		long run = 1L;
		String str = anagrams.get(0);
		for (int i = 1; i < N; i++) {
			if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			}
		}
		ans += run*(run-1)/2;
		
		System.out.println(ans);
	}
	
	static class DisjointSetUnion {
		  public int[] parent;
		  public int[] rank;
		  public int count;

		  public DisjointSetUnion(int nodes) {
			  count = nodes;
			  parent = new int[nodes];
			  rank = new int[nodes];
			  for (int i = 0; i < nodes; i++) {
				  parent[i] = i;
				  rank[i] = 0;
			  }
		  }
		  //"find"
		  public int root(int p) {
			  if (parent[p] != p)
				  parent[p] = root(parent[p]);
			  return parent[p];
		  }

		  //"union"
		  public void connect(int p, int q) {
			  int rootP = root(p);
			  int rootQ = root(q);
			  if (rootP == rootQ) return;
			  if (rank[rootP] < rank[rootQ]) {
				  parent[rootP] = rootQ;
			  } else if (rank[rootP] > rank[rootQ]) {
				  parent[rootQ] = rootP;
			  } else {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  }
			  count--;
		  }

		  public boolean connected(int p, int q) {
		    return root(p) == root(q);
		  }
	}
    
    public static long power(long x, long y, long p) { 
        // Initialize result
        long res = 1;
         
        // Update x if it is more   
        // than or equal to p 
        x = x % p;  
      
        while (y > 0) 
        { 
            // If y is odd, multiply x 
            // with result 
            if((y & 1)==1) 
                res = (res * x) % p; 
      
            // y must be even now 
            // y = y / 2 
            y = y >> 1;  
            x = (x * x) % p;  
        } 
        return res; 
    }
    
    public static long dist(int[] point, int[] point2) {
    	return (long)(Math.pow((point2[1]-point[1]),2)+Math.pow((point2[0]-point[0]),2));
    }
    
    public static long gcd(long a, long b) {
    	if (b == 0)
    		return a;
    	else
    		return gcd(b,a%b);
    }
    
    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          }
		});
		return array;
	}
    
    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          }
		});
		return array;
	}
    
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str; 
        }
    }
} Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          }
		} @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          } compare {
				  return arr1[0]-arr2[0];
	          } return arr1[0]-arr2[0]; arr1[0]-arr2[0] arr1[0] arr1 0 arr2[0] arr2 0 int[] arr1 arr1 int[] arr2 arr2 Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          }
		} @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          } compare {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          } if (arr1[0] < arr2[0])
					  return -1; arr1[0] < arr2[0] arr1[0] arr1 0 arr2[0] arr2 0 return -1; -1 1 if (arr1[0] > arr2[0])
					  return 1; arr1[0] > arr2[0] arr1[0] arr1 0 arr2[0] arr2 0 return 1; 1 return 0; 0 long[] arr1 arr1 long[] arr2 arr2 import java.io.*; io.* java import java.math.*; math.* java import java.util.*; util.* java import java.awt.Point; Point java.awt public class Main {
	//static final long MOD = 998244353;
	static final long MOD = 1000000007;
	static final int INF = 1000000007;
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.ni();
		ArrayList<String> anagrams = new ArrayList<String>(N);
		for (int i = 0; i < N; i++) {
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			StringBuilder converted = new StringBuilder();
			for (char c: s)
				converted.append(c);
			anagrams.add(converted.toString());
		}

		Collections.sort(anagrams);

		long ans = 0;
		long run = 1L;
		String str = anagrams.get(0);
		for (int i = 1; i < N; i++) {
			if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			}
		}
		ans += run*(run-1)/2;
		
		System.out.println(ans);
	}
	
	static class DisjointSetUnion {
		  public int[] parent;
		  public int[] rank;
		  public int count;

		  public DisjointSetUnion(int nodes) {
			  count = nodes;
			  parent = new int[nodes];
			  rank = new int[nodes];
			  for (int i = 0; i < nodes; i++) {
				  parent[i] = i;
				  rank[i] = 0;
			  }
		  }
		  //"find"
		  public int root(int p) {
			  if (parent[p] != p)
				  parent[p] = root(parent[p]);
			  return parent[p];
		  }

		  //"union"
		  public void connect(int p, int q) {
			  int rootP = root(p);
			  int rootQ = root(q);
			  if (rootP == rootQ) return;
			  if (rank[rootP] < rank[rootQ]) {
				  parent[rootP] = rootQ;
			  } else if (rank[rootP] > rank[rootQ]) {
				  parent[rootQ] = rootP;
			  } else {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  }
			  count--;
		  }

		  public boolean connected(int p, int q) {
		    return root(p) == root(q);
		  }
	}
    
    public static long power(long x, long y, long p) { 
        // Initialize result
        long res = 1;
         
        // Update x if it is more   
        // than or equal to p 
        x = x % p;  
      
        while (y > 0) 
        { 
            // If y is odd, multiply x 
            // with result 
            if((y & 1)==1) 
                res = (res * x) % p; 
      
            // y must be even now 
            // y = y / 2 
            y = y >> 1;  
            x = (x * x) % p;  
        } 
        return res; 
    }
    
    public static long dist(int[] point, int[] point2) {
    	return (long)(Math.pow((point2[1]-point[1]),2)+Math.pow((point2[0]-point[0]),2));
    }
    
    public static long gcd(long a, long b) {
    	if (b == 0)
    		return a;
    	else
    		return gcd(b,a%b);
    }
    
    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          }
		});
		return array;
	}
    
    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          }
		});
		return array;
	}
    
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str; 
        }
    }
} Main //static final long MOD = 998244353;
	static final long MOD = 1000000007; MOD 1000000007 static final int INF = 1000000007; INF 1000000007 public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.ni();
		ArrayList<String> anagrams = new ArrayList<String>(N);
		for (int i = 0; i < N; i++) {
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			StringBuilder converted = new StringBuilder();
			for (char c: s)
				converted.append(c);
			anagrams.add(converted.toString());
		}

		Collections.sort(anagrams);

		long ans = 0;
		long run = 1L;
		String str = anagrams.get(0);
		for (int i = 1; i < N; i++) {
			if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			}
		}
		ans += run*(run-1)/2;
		
		System.out.println(ans);
	} main {
		FastScanner sc = new FastScanner();
		int N = sc.ni();
		ArrayList<String> anagrams = new ArrayList<String>(N);
		for (int i = 0; i < N; i++) {
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			StringBuilder converted = new StringBuilder();
			for (char c: s)
				converted.append(c);
			anagrams.add(converted.toString());
		}

		Collections.sort(anagrams);

		long ans = 0;
		long run = 1L;
		String str = anagrams.get(0);
		for (int i = 1; i < N; i++) {
			if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			}
		}
		ans += run*(run-1)/2;
		
		System.out.println(ans);
	} FastScanner sc = new FastScanner(); sc new FastScanner() int N = sc.ni(); N sc.ni() sc.ni sc ArrayList<String> anagrams = new ArrayList<String>(N); anagrams new ArrayList<String>(N) for (int i = 0; i < N; i++) {
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			StringBuilder converted = new StringBuilder();
			for (char c: s)
				converted.append(c);
			anagrams.add(converted.toString());
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			StringBuilder converted = new StringBuilder();
			for (char c: s)
				converted.append(c);
			anagrams.add(converted.toString());
		} {
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			StringBuilder converted = new StringBuilder();
			for (char c: s)
				converted.append(c);
			anagrams.add(converted.toString());
		} char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(s) Arrays.sort Arrays s StringBuilder converted = new StringBuilder(); converted new StringBuilder() for (char c: s)
				converted.append(c); char c s converted.append(c); converted.append(c) converted.append converted c anagrams.add(converted.toString()) anagrams.add anagrams converted.toString() converted.toString converted Collections.sort(anagrams) Collections.sort Collections anagrams long ans = 0; ans 0 long run = 1L; run 1L String str = anagrams.get(0); str anagrams.get(0) anagrams.get anagrams 0 for (int i = 1; i < N; i++) {
			if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			}
		} int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
			if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			}
		} {
			if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			}
		} if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			} anagrams.get(i).equals(str) anagrams.get(i).equals anagrams.get(i) anagrams.get anagrams i str {
				run++;
			} run++ run {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			} ans += run*(run-1)/2 ans run*(run-1)/2 run*(run-1) run (run-1) run 1 2 run=1L run 1L str = anagrams.get(i) str anagrams.get(i) anagrams.get anagrams i ans += run*(run-1)/2 ans run*(run-1)/2 run*(run-1) run (run-1) run 1 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static long power(long x, long y, long p) { 
        // Initialize result
        long res = 1;
         
        // Update x if it is more   
        // than or equal to p 
        x = x % p;  
      
        while (y > 0) 
        { 
            // If y is odd, multiply x 
            // with result 
            if((y & 1)==1) 
                res = (res * x) % p; 
      
            // y must be even now 
            // y = y / 2 
            y = y >> 1;  
            x = (x * x) % p;  
        } 
        return res; 
    } power { 
        // Initialize result
        long res = 1;
         
        // Update x if it is more   
        // than or equal to p 
        x = x % p;  
      
        while (y > 0) 
        { 
            // If y is odd, multiply x 
            // with result 
            if((y & 1)==1) 
                res = (res * x) % p; 
      
            // y must be even now 
            // y = y / 2 
            y = y >> 1;  
            x = (x * x) % p;  
        } 
        return res; 
    } long res = 1; res 1 x = x % p x x % p x p while (y > 0) 
        { 
            // If y is odd, multiply x 
            // with result 
            if((y & 1)==1) 
                res = (res * x) % p; 
      
            // y must be even now 
            // y = y / 2 
            y = y >> 1;  
            x = (x * x) % p;  
        } y > 0 y 0 { 
            // If y is odd, multiply x 
            // with result 
            if((y & 1)==1) 
                res = (res * x) % p; 
      
            // y must be even now 
            // y = y / 2 
            y = y >> 1;  
            x = (x * x) % p;  
        } if((y & 1)==1) 
                res = (res * x) % p; (y & 1)==1 (y & 1) y 1 1 res = (res * x) % p res (res * x) % p (res * x) res x p y = y >> 1 y y >> 1 y 1 x = (x * x) % p x (x * x) % p (x * x) x x p return res; res long x x long y y long p p public static long dist(int[] point, int[] point2) {
    	return (long)(Math.pow((point2[1]-point[1]),2)+Math.pow((point2[0]-point[0]),2));
    } dist {
    	return (long)(Math.pow((point2[1]-point[1]),2)+Math.pow((point2[0]-point[0]),2));
    } return (long)(Math.pow((point2[1]-point[1]),2)+Math.pow((point2[0]-point[0]),2)); (long)(Math.pow((point2[1]-point[1]),2)+Math.pow((point2[0]-point[0]),2)) Math.pow((point2[1]-point[1]),2) Math.pow Math (point2[1]-point[1]) point2[1] point2 1 point[1] point 1 2 Math.pow((point2[0]-point[0]),2) Math.pow Math (point2[0]-point[0]) point2[0] point2 0 point[0] point 0 2 int[] point point int[] point2 point2 public static long gcd(long a, long b) {
    	if (b == 0)
    		return a;
    	else
    		return gcd(b,a%b);
    } gcd {
    	if (b == 0)
    		return a;
    	else
    		return gcd(b,a%b);
    } if (b == 0)
    		return a;
    	else
    		return gcd(b,a%b); b == 0 b 0 return a; a return gcd(b,a%b); gcd(b,a%b) gcd b a%b a b long a a long b b public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          }
		});
		return array;
	} sort {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          }
		});
		return array;
	} Random rgen = new Random(); rgen new Random() for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		} int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		} {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		} int randomPosition = rgen.nextInt(array.length); randomPosition rgen.nextInt(array.length) rgen.nextInt rgen array.length array array.length int[] temp = array[i]; temp array[i] array i array[i] = array[randomPosition] array[i] array i array[randomPosition] array randomPosition array[randomPosition] = temp array[randomPosition] array randomPosition temp Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          }
		}) Arrays.sort Arrays array new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          }
		} return array; array int[][] array array public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          }
		});
		return array;
	} sort {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          }
		});
		return array;
	} Random rgen = new Random(); rgen new Random() for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		} int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		} {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		} int randomPosition = rgen.nextInt(array.length); randomPosition rgen.nextInt(array.length) rgen.nextInt rgen array.length array array.length long[] temp = array[i]; temp array[i] array i array[i] = array[randomPosition] array[i] array i array[randomPosition] array randomPosition array[randomPosition] = temp array[randomPosition] array randomPosition temp Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          }
		}) Arrays.sort Arrays array new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          }
		} return array; array long[][] array array static class DisjointSetUnion {
		  public int[] parent;
		  public int[] rank;
		  public int count;

		  public DisjointSetUnion(int nodes) {
			  count = nodes;
			  parent = new int[nodes];
			  rank = new int[nodes];
			  for (int i = 0; i < nodes; i++) {
				  parent[i] = i;
				  rank[i] = 0;
			  }
		  }
		  //"find"
		  public int root(int p) {
			  if (parent[p] != p)
				  parent[p] = root(parent[p]);
			  return parent[p];
		  }

		  //"union"
		  public void connect(int p, int q) {
			  int rootP = root(p);
			  int rootQ = root(q);
			  if (rootP == rootQ) return;
			  if (rank[rootP] < rank[rootQ]) {
				  parent[rootP] = rootQ;
			  } else if (rank[rootP] > rank[rootQ]) {
				  parent[rootQ] = rootP;
			  } else {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  }
			  count--;
		  }

		  public boolean connected(int p, int q) {
		    return root(p) == root(q);
		  }
	} DisjointSetUnion public int[] parent; parent public int[] rank; rank public int count; count public DisjointSetUnion(int nodes) {
			  count = nodes;
			  parent = new int[nodes];
			  rank = new int[nodes];
			  for (int i = 0; i < nodes; i++) {
				  parent[i] = i;
				  rank[i] = 0;
			  }
		  } DisjointSetUnion {
			  count = nodes;
			  parent = new int[nodes];
			  rank = new int[nodes];
			  for (int i = 0; i < nodes; i++) {
				  parent[i] = i;
				  rank[i] = 0;
			  }
		  } count = nodes count nodes parent = new int[nodes] parent new int[nodes] nodes rank = new int[nodes] rank new int[nodes] nodes for (int i = 0; i < nodes; i++) {
				  parent[i] = i;
				  rank[i] = 0;
			  } int i = 0; int i = 0; i 0 i < nodes i nodes i++ i++ i {
				  parent[i] = i;
				  rank[i] = 0;
			  } {
				  parent[i] = i;
				  rank[i] = 0;
			  } parent[i] = i parent[i] parent i i rank[i] = 0 rank[i] rank i 0 int nodes nodes //"find"
		  public int root(int p) {
			  if (parent[p] != p)
				  parent[p] = root(parent[p]);
			  return parent[p];
		  } root {
			  if (parent[p] != p)
				  parent[p] = root(parent[p]);
			  return parent[p];
		  } if (parent[p] != p)
				  parent[p] = root(parent[p]); parent[p] != p parent[p] parent p p parent[p] = root(parent[p]) parent[p] parent p root(parent[p]) root parent[p] parent p return parent[p]; parent[p] parent p int p p //"union"
		  public void connect(int p, int q) {
			  int rootP = root(p);
			  int rootQ = root(q);
			  if (rootP == rootQ) return;
			  if (rank[rootP] < rank[rootQ]) {
				  parent[rootP] = rootQ;
			  } else if (rank[rootP] > rank[rootQ]) {
				  parent[rootQ] = rootP;
			  } else {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  }
			  count--;
		  } connect {
			  int rootP = root(p);
			  int rootQ = root(q);
			  if (rootP == rootQ) return;
			  if (rank[rootP] < rank[rootQ]) {
				  parent[rootP] = rootQ;
			  } else if (rank[rootP] > rank[rootQ]) {
				  parent[rootQ] = rootP;
			  } else {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  }
			  count--;
		  } int rootP = root(p); rootP root(p) root p int rootQ = root(q); rootQ root(q) root q if (rootP == rootQ) return; rootP == rootQ rootP rootQ return; if (rank[rootP] < rank[rootQ]) {
				  parent[rootP] = rootQ;
			  } else if (rank[rootP] > rank[rootQ]) {
				  parent[rootQ] = rootP;
			  } else {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  } rank[rootP] < rank[rootQ] rank[rootP] rank rootP rank[rootQ] rank rootQ {
				  parent[rootP] = rootQ;
			  } parent[rootP] = rootQ parent[rootP] parent rootP rootQ if (rank[rootP] > rank[rootQ]) {
				  parent[rootQ] = rootP;
			  } else {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  } rank[rootP] > rank[rootQ] rank[rootP] rank rootP rank[rootQ] rank rootQ {
				  parent[rootQ] = rootP;
			  } parent[rootQ] = rootP parent[rootQ] parent rootQ rootP {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  } parent[rootP] = rootQ parent[rootP] parent rootP rootQ rank[rootQ] += 1 rank[rootQ] rank rootQ 1 count-- count int p p int q q public boolean connected(int p, int q) {
		    return root(p) == root(q);
		  } connected {
		    return root(p) == root(q);
		  } return root(p) == root(q); root(p) == root(q) root(p) root p root(q) root q int p p int q q static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str; 
        }
    } FastScanner BufferedReader br; br StringTokenizer st; st public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } FastScanner { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } next { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } IOException  e { 
                    e.printStackTrace(); 
                } e.printStackTrace() e.printStackTrace e { 
                    st = new StringTokenizer(br.readLine());
                } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int ni() { 
            return Integer.parseInt(next()); 
        } ni { 
            return Integer.parseInt(next()); 
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nl() { 
            return Long.parseLong(next()); 
        } nl { 
            return Long.parseLong(next()); 
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nd() { 
            return Double.parseDouble(next()); 
        } nd { 
            return Double.parseDouble(next()); 
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str; 
        } nextLine { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str; 
        } String str = ""; str "" try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } IOException e {
                e.printStackTrace(); 
            } e.printStackTrace() e.printStackTrace e { 
                str = br.readLine(); 
            } str = br.readLine() str br.readLine() br.readLine br return str; str public class Main {
	//static final long MOD = 998244353;
	static final long MOD = 1000000007;
	static final int INF = 1000000007;
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.ni();
		ArrayList<String> anagrams = new ArrayList<String>(N);
		for (int i = 0; i < N; i++) {
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			StringBuilder converted = new StringBuilder();
			for (char c: s)
				converted.append(c);
			anagrams.add(converted.toString());
		}

		Collections.sort(anagrams);

		long ans = 0;
		long run = 1L;
		String str = anagrams.get(0);
		for (int i = 1; i < N; i++) {
			if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			}
		}
		ans += run*(run-1)/2;
		
		System.out.println(ans);
	}
	
	static class DisjointSetUnion {
		  public int[] parent;
		  public int[] rank;
		  public int count;

		  public DisjointSetUnion(int nodes) {
			  count = nodes;
			  parent = new int[nodes];
			  rank = new int[nodes];
			  for (int i = 0; i < nodes; i++) {
				  parent[i] = i;
				  rank[i] = 0;
			  }
		  }
		  //"find"
		  public int root(int p) {
			  if (parent[p] != p)
				  parent[p] = root(parent[p]);
			  return parent[p];
		  }

		  //"union"
		  public void connect(int p, int q) {
			  int rootP = root(p);
			  int rootQ = root(q);
			  if (rootP == rootQ) return;
			  if (rank[rootP] < rank[rootQ]) {
				  parent[rootP] = rootQ;
			  } else if (rank[rootP] > rank[rootQ]) {
				  parent[rootQ] = rootP;
			  } else {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  }
			  count--;
		  }

		  public boolean connected(int p, int q) {
		    return root(p) == root(q);
		  }
	}
    
    public static long power(long x, long y, long p) { 
        // Initialize result
        long res = 1;
         
        // Update x if it is more   
        // than or equal to p 
        x = x % p;  
      
        while (y > 0) 
        { 
            // If y is odd, multiply x 
            // with result 
            if((y & 1)==1) 
                res = (res * x) % p; 
      
            // y must be even now 
            // y = y / 2 
            y = y >> 1;  
            x = (x * x) % p;  
        } 
        return res; 
    }
    
    public static long dist(int[] point, int[] point2) {
    	return (long)(Math.pow((point2[1]-point[1]),2)+Math.pow((point2[0]-point[0]),2));
    }
    
    public static long gcd(long a, long b) {
    	if (b == 0)
    		return a;
    	else
    		return gcd(b,a%b);
    }
    
    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          }
		});
		return array;
	}
    
    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          }
		});
		return array;
	}
    
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str; 
        }
    }
} public class Main {
	//static final long MOD = 998244353;
	static final long MOD = 1000000007;
	static final int INF = 1000000007;
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.ni();
		ArrayList<String> anagrams = new ArrayList<String>(N);
		for (int i = 0; i < N; i++) {
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			StringBuilder converted = new StringBuilder();
			for (char c: s)
				converted.append(c);
			anagrams.add(converted.toString());
		}

		Collections.sort(anagrams);

		long ans = 0;
		long run = 1L;
		String str = anagrams.get(0);
		for (int i = 1; i < N; i++) {
			if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			}
		}
		ans += run*(run-1)/2;
		
		System.out.println(ans);
	}
	
	static class DisjointSetUnion {
		  public int[] parent;
		  public int[] rank;
		  public int count;

		  public DisjointSetUnion(int nodes) {
			  count = nodes;
			  parent = new int[nodes];
			  rank = new int[nodes];
			  for (int i = 0; i < nodes; i++) {
				  parent[i] = i;
				  rank[i] = 0;
			  }
		  }
		  //"find"
		  public int root(int p) {
			  if (parent[p] != p)
				  parent[p] = root(parent[p]);
			  return parent[p];
		  }

		  //"union"
		  public void connect(int p, int q) {
			  int rootP = root(p);
			  int rootQ = root(q);
			  if (rootP == rootQ) return;
			  if (rank[rootP] < rank[rootQ]) {
				  parent[rootP] = rootQ;
			  } else if (rank[rootP] > rank[rootQ]) {
				  parent[rootQ] = rootP;
			  } else {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  }
			  count--;
		  }

		  public boolean connected(int p, int q) {
		    return root(p) == root(q);
		  }
	}
    
    public static long power(long x, long y, long p) { 
        // Initialize result
        long res = 1;
         
        // Update x if it is more   
        // than or equal to p 
        x = x % p;  
      
        while (y > 0) 
        { 
            // If y is odd, multiply x 
            // with result 
            if((y & 1)==1) 
                res = (res * x) % p; 
      
            // y must be even now 
            // y = y / 2 
            y = y >> 1;  
            x = (x * x) % p;  
        } 
        return res; 
    }
    
    public static long dist(int[] point, int[] point2) {
    	return (long)(Math.pow((point2[1]-point[1]),2)+Math.pow((point2[0]-point[0]),2));
    }
    
    public static long gcd(long a, long b) {
    	if (b == 0)
    		return a;
    	else
    		return gcd(b,a%b);
    }
    
    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          }
		});
		return array;
	}
    
    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          }
		});
		return array;
	}
    
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str; 
        }
    }
} Main
import java.io.*; 
import java.math.*;
import java.util.*;
import java.awt.Point;
 
public class Main {
	//static final long MOD = 998244353;
	static final long MOD = 1000000007;
	static final int INF = 1000000007;
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.ni();
		ArrayList<String> anagrams = new ArrayList<String>(N);
		for (int i = 0; i < N; i++) {
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			StringBuilder converted = new StringBuilder();
			for (char c: s)
				converted.append(c);
			anagrams.add(converted.toString());
		}

		Collections.sort(anagrams);

		long ans = 0;
		long run = 1L;
		String str = anagrams.get(0);
		for (int i = 1; i < N; i++) {
			if (anagrams.get(i).equals(str)) {
				run++;
			} else {
				ans += run*(run-1)/2;
				run=1L;
				str = anagrams.get(i);
			}
		}
		ans += run*(run-1)/2;
		
		System.out.println(ans);
	}
	
	static class DisjointSetUnion {
		  public int[] parent;
		  public int[] rank;
		  public int count;

		  public DisjointSetUnion(int nodes) {
			  count = nodes;
			  parent = new int[nodes];
			  rank = new int[nodes];
			  for (int i = 0; i < nodes; i++) {
				  parent[i] = i;
				  rank[i] = 0;
			  }
		  }
		  //"find"
		  public int root(int p) {
			  if (parent[p] != p)
				  parent[p] = root(parent[p]);
			  return parent[p];
		  }

		  //"union"
		  public void connect(int p, int q) {
			  int rootP = root(p);
			  int rootQ = root(q);
			  if (rootP == rootQ) return;
			  if (rank[rootP] < rank[rootQ]) {
				  parent[rootP] = rootQ;
			  } else if (rank[rootP] > rank[rootQ]) {
				  parent[rootQ] = rootP;
			  } else {
				  parent[rootP] = rootQ;
				  rank[rootQ] += 1;
			  }
			  count--;
		  }

		  public boolean connected(int p, int q) {
		    return root(p) == root(q);
		  }
	}
    
    public static long power(long x, long y, long p) { 
        // Initialize result
        long res = 1;
         
        // Update x if it is more   
        // than or equal to p 
        x = x % p;  
      
        while (y > 0) 
        { 
            // If y is odd, multiply x 
            // with result 
            if((y & 1)==1) 
                res = (res * x) % p; 
      
            // y must be even now 
            // y = y / 2 
            y = y >> 1;  
            x = (x * x) % p;  
        } 
        return res; 
    }
    
    public static long dist(int[] point, int[] point2) {
    	return (long)(Math.pow((point2[1]-point[1]),2)+Math.pow((point2[0]-point[0]),2));
    }
    
    public static long gcd(long a, long b) {
    	if (b == 0)
    		return a;
    	else
    		return gcd(b,a%b);
    }
    
    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0];
	          }
		});
		return array;
	}
    
    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr1[0] < arr2[0])
					  return -1;
				  if (arr1[0] > arr2[0])
					  return 1;
				  return 0;
	          }
		});
		return array;
	}
    
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str; 
        }
    }
}