import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   char[][] c = new char[N][10];
   String[] fa = new String[N];
   for(int i=0;i<N;i++) 
   {
     c[i] = sc.next().toCharArray();
     Arrays.sort(c[i]);
     fa[i] = new String(c[i]); 
   }
   Arrays.sort(fa);
   String tmp = fa[0];
   long count = 0;
   long ans = 0 ;
   for(int i=1;i<N;i++)
   {
     if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     }
   }
   System.out.println(ans);
 }
} import java.util.*; util.* java public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   char[][] c = new char[N][10];
   String[] fa = new String[N];
   for(int i=0;i<N;i++) 
   {
     c[i] = sc.next().toCharArray();
     Arrays.sort(c[i]);
     fa[i] = new String(c[i]); 
   }
   Arrays.sort(fa);
   String tmp = fa[0];
   long count = 0;
   long ans = 0 ;
   for(int i=1;i<N;i++)
   {
     if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     }
   }
   System.out.println(ans);
 }
} Main public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   char[][] c = new char[N][10];
   String[] fa = new String[N];
   for(int i=0;i<N;i++) 
   {
     c[i] = sc.next().toCharArray();
     Arrays.sort(c[i]);
     fa[i] = new String(c[i]); 
   }
   Arrays.sort(fa);
   String tmp = fa[0];
   long count = 0;
   long ans = 0 ;
   for(int i=1;i<N;i++)
   {
     if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     }
   }
   System.out.println(ans);
 } main {
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   char[][] c = new char[N][10];
   String[] fa = new String[N];
   for(int i=0;i<N;i++) 
   {
     c[i] = sc.next().toCharArray();
     Arrays.sort(c[i]);
     fa[i] = new String(c[i]); 
   }
   Arrays.sort(fa);
   String tmp = fa[0];
   long count = 0;
   long ans = 0 ;
   for(int i=1;i<N;i++)
   {
     if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     }
   }
   System.out.println(ans);
 } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc char[][] c = new char[N][10]; c new char[N][10] N 10 String[] fa = new String[N]; fa new String[N] N for(int i=0;i<N;i++) 
   {
     c[i] = sc.next().toCharArray();
     Arrays.sort(c[i]);
     fa[i] = new String(c[i]); 
   } int i=0; int i=0; i 0 i<N i N i++ i++ i {
     c[i] = sc.next().toCharArray();
     Arrays.sort(c[i]);
     fa[i] = new String(c[i]); 
   } {
     c[i] = sc.next().toCharArray();
     Arrays.sort(c[i]);
     fa[i] = new String(c[i]); 
   } c[i] = sc.next().toCharArray() c[i] c i sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(c[i]) Arrays.sort Arrays c[i] c i fa[i] = new String(c[i]) fa[i] fa i new String(c[i]) Arrays.sort(fa) Arrays.sort Arrays fa String tmp = fa[0]; tmp fa[0] fa 0 long count = 0; count 0 long ans = 0 ; ans 0 for(int i=1;i<N;i++)
   {
     if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     }
   } int i=1; int i=1; i 1 i<N i N i++ i++ i {
     if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     }
   } {
     if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     }
   } if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     } tmp.equals(fa[i]) tmp.equals tmp fa[i] fa i {
       count++;
       ans+=count;
     } count++ count ans+=count ans count {
       count = 0;
       tmp = fa[i];
     } count = 0 count 0 tmp = fa[i] tmp fa[i] fa i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   char[][] c = new char[N][10];
   String[] fa = new String[N];
   for(int i=0;i<N;i++) 
   {
     c[i] = sc.next().toCharArray();
     Arrays.sort(c[i]);
     fa[i] = new String(c[i]); 
   }
   Arrays.sort(fa);
   String tmp = fa[0];
   long count = 0;
   long ans = 0 ;
   for(int i=1;i<N;i++)
   {
     if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     }
   }
   System.out.println(ans);
 }
} public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   char[][] c = new char[N][10];
   String[] fa = new String[N];
   for(int i=0;i<N;i++) 
   {
     c[i] = sc.next().toCharArray();
     Arrays.sort(c[i]);
     fa[i] = new String(c[i]); 
   }
   Arrays.sort(fa);
   String tmp = fa[0];
   long count = 0;
   long ans = 0 ;
   for(int i=1;i<N;i++)
   {
     if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     }
   }
   System.out.println(ans);
 }
} Main
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   char[][] c = new char[N][10];
   String[] fa = new String[N];
   for(int i=0;i<N;i++) 
   {
     c[i] = sc.next().toCharArray();
     Arrays.sort(c[i]);
     fa[i] = new String(c[i]); 
   }
   Arrays.sort(fa);
   String tmp = fa[0];
   long count = 0;
   long ans = 0 ;
   for(int i=1;i<N;i++)
   {
     if(tmp.equals(fa[i]))
     {
       count++;
       ans+=count;
     }
     else
     {
       count = 0;
       tmp = fa[i];
     }
   }
   System.out.println(ans);
 }
}