            
import java.util.*;import java.io.*;import java.math.*;

public class Main
{
    
    public static void process()throws IOException
    {
        int n=ni();
        char arr[][]=new char[n+1][];

        for(int i=1;i<=n;i++) {arr[i]=(nln()).toCharArray(); Arrays.sort(arr[i]);}

        ArrayList<String> li = new ArrayList<>();

        for(int i=1;i<=n;i++) li.add(new String(arr[i]));

        Collections.sort(li);li.add(" ");
        String curr=li.get(0);
        //System.out.println(li);
        long cnt=0,res=0l;

        for(int i=0;i<=n;i++){
            if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            }
            cnt++;
        }
        pn(res);
    }


    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        //oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;
    static long mod=(long)1e9+7l;

    static void r_sort(double arr[],int n){
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            double temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    }

    static long mpow(long x, long n) {
        if(n == 0)
            return 1;
        if(n % 2 == 0) {
            long root = mpow(x, n / 2);
            return root * root % mod;
        }else {
            return x * mpow(x, n - 1) % mod;
        }
    }
    
    static long mcomb(long a, long b) {
        if(b > a - b)
            return mcomb(a, a - b);
        long m = 1;
        long d = 1;
        long i;
        for(i = 0; i < b; i++) {
            m *= (a - i);
            m %= mod;
            d *= (i + 1);
            d %= mod;
        }
        long ans = m * mpow(d, mod - 2) % mod;
        return ans;
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
} import java.util.*; util.* java import java.io.*; io.* java import java.math.*; math.* java public class Main
{
    
    public static void process()throws IOException
    {
        int n=ni();
        char arr[][]=new char[n+1][];

        for(int i=1;i<=n;i++) {arr[i]=(nln()).toCharArray(); Arrays.sort(arr[i]);}

        ArrayList<String> li = new ArrayList<>();

        for(int i=1;i<=n;i++) li.add(new String(arr[i]));

        Collections.sort(li);li.add(" ");
        String curr=li.get(0);
        //System.out.println(li);
        long cnt=0,res=0l;

        for(int i=0;i<=n;i++){
            if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            }
            cnt++;
        }
        pn(res);
    }


    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        //oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;
    static long mod=(long)1e9+7l;

    static void r_sort(double arr[],int n){
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            double temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    }

    static long mpow(long x, long n) {
        if(n == 0)
            return 1;
        if(n % 2 == 0) {
            long root = mpow(x, n / 2);
            return root * root % mod;
        }else {
            return x * mpow(x, n - 1) % mod;
        }
    }
    
    static long mcomb(long a, long b) {
        if(b > a - b)
            return mcomb(a, a - b);
        long m = 1;
        long d = 1;
        long i;
        for(i = 0; i < b; i++) {
            m *= (a - i);
            m %= mod;
            d *= (i + 1);
            d %= mod;
        }
        long ans = m * mpow(d, mod - 2) % mod;
        return ans;
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
} Main static AnotherReader sc; sc static PrintWriter out; out static boolean multipleTC=false; multipleTC false static long mod=(long)1e9+7l; mod (long)1e9+7l (long)1e9 7l public static void process()throws IOException
    {
        int n=ni();
        char arr[][]=new char[n+1][];

        for(int i=1;i<=n;i++) {arr[i]=(nln()).toCharArray(); Arrays.sort(arr[i]);}

        ArrayList<String> li = new ArrayList<>();

        for(int i=1;i<=n;i++) li.add(new String(arr[i]));

        Collections.sort(li);li.add(" ");
        String curr=li.get(0);
        //System.out.println(li);
        long cnt=0,res=0l;

        for(int i=0;i<=n;i++){
            if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            }
            cnt++;
        }
        pn(res);
    } process {
        int n=ni();
        char arr[][]=new char[n+1][];

        for(int i=1;i<=n;i++) {arr[i]=(nln()).toCharArray(); Arrays.sort(arr[i]);}

        ArrayList<String> li = new ArrayList<>();

        for(int i=1;i<=n;i++) li.add(new String(arr[i]));

        Collections.sort(li);li.add(" ");
        String curr=li.get(0);
        //System.out.println(li);
        long cnt=0,res=0l;

        for(int i=0;i<=n;i++){
            if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            }
            cnt++;
        }
        pn(res);
    } int n=ni(); n ni() ni char arr[][]=new char[n+1][]; arr new char[n+1][] n+1 n 1 for(int i=1;i<=n;i++) {arr[i]=(nln()).toCharArray(); Arrays.sort(arr[i]);} int i=1; int i=1; i 1 i<=n i n i++ i++ i {arr[i]=(nln()).toCharArray(); Arrays.sort(arr[i]);} {arr[i]=(nln()).toCharArray(); Arrays.sort(arr[i]);} arr[i]=(nln()).toCharArray() arr[i] arr i (nln()).toCharArray() (nln()).toCharArray (nln()) nln Arrays.sort(arr[i]) Arrays.sort Arrays arr[i] arr i ArrayList<String> li = new ArrayList<>(); li new ArrayList<>() for(int i=1;i<=n;i++) li.add(new String(arr[i])); int i=1; int i=1; i 1 i<=n i n i++ i++ i li.add(new String(arr[i])); li.add(new String(arr[i])) li.add li new String(arr[i]) Collections.sort(li) Collections.sort Collections li li.add(" ") li.add li " " String curr=li.get(0); curr li.get(0) li.get li 0 long cnt=0 cnt 0 res=0l; res 0l for(int i=0;i<=n;i++){
            if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            }
            cnt++;
        } int i=0; int i=0; i 0 i<=n i n i++ i++ i {
            if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            }
            cnt++;
        } {
            if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            }
            cnt++;
        } if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            } curr.compareTo(li.get(i))!=0 curr.compareTo(li.get(i)) curr.compareTo curr li.get(i) li.get li i 0 {
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            } curr=li.get(i) curr li.get(i) li.get li i res+=(cnt*(cnt-1l)/2l) res (cnt*(cnt-1l)/2l) cnt*(cnt-1l) cnt (cnt-1l) cnt 1l 2l cnt=0 cnt 0 cnt++ cnt pn(res) pn res public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        //oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    } main {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        //oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    } out = new PrintWriter(System.out) out new PrintWriter(System.out) sc=new AnotherReader() sc new AnotherReader() boolean oj = true; oj true if(!oj) sc=new AnotherReader(100); !oj oj sc=new AnotherReader(100) sc new AnotherReader(100) long s = System.currentTimeMillis(); s System.currentTimeMillis() System.currentTimeMillis System int t=1; t 1 while(t-->0)
            process(); t-->0 t-- t 0 process() process out.flush() out.flush out if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms"); !oj oj System.out.println(System.currentTimeMillis()-s+"ms") System.out.println System.out System System.out System.currentTimeMillis()-s+"ms" System.currentTimeMillis()-s System.currentTimeMillis() System.currentTimeMillis System s "ms" System.out.close() System.out.close System.out System System.out String[]args args static void pn(Object o){out.println(o);} pn {out.println(o);} out.println(o) out.println out o Object o o static void p(Object o){out.print(o);} p {out.print(o);} out.print(o) out.print out o Object o o static void pni(Object o){out.println(o);System.out.flush();} pni {out.println(o);System.out.flush();} out.println(o) out.println out o System.out.flush() System.out.flush System.out System System.out Object o o static int ni()throws IOException{return sc.nextInt();} ni {return sc.nextInt();} return sc.nextInt(); sc.nextInt() sc.nextInt sc static long nl()throws IOException{return sc.nextLong();} nl {return sc.nextLong();} return sc.nextLong(); sc.nextLong() sc.nextLong sc static double nd()throws IOException{return sc.nextDouble();} nd {return sc.nextDouble();} return sc.nextDouble(); sc.nextDouble() sc.nextDouble sc static String nln()throws IOException{return sc.nextLine();} nln {return sc.nextLine();} return sc.nextLine(); sc.nextLine() sc.nextLine sc static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);} gcd {return (b==0)?a:gcd(b,a%b);} return (b==0)?a:gcd(b,a%b); (b==0)?a:gcd(b,a%b) (b==0) b 0 a gcd(b,a%b) gcd b a%b a b long a a long b b static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);} gcd {return (b==0)?a:gcd(b,a%b);} return (b==0)?a:gcd(b,a%b); (b==0)?a:gcd(b,a%b) (b==0) b 0 a gcd(b,a%b) gcd b a%b a b int a a int b b static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));} bit {return (n==0)?0:(1+bit(n&(n-1)));} return (n==0)?0:(1+bit(n&(n-1))); (n==0)?0:(1+bit(n&(n-1))) (n==0) n 0 0 (1+bit(n&(n-1))) 1 bit(n&(n-1)) bit n&(n-1) n (n-1) n 1 long n n static void r_sort(double arr[],int n){
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            double temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    } r_sort {
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            double temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    } Random r = new Random(); r new Random() for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            double temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } int i = n-1; int i = n-1; i n-1 n 1 i > 0 i 0 i-- i-- i { 
            int j = r.nextInt(i+1); 
                  
            double temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } { 
            int j = r.nextInt(i+1); 
                  
            double temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } int j = r.nextInt(i+1); j r.nextInt(i+1) r.nextInt r i+1 i 1 double temp = arr[i]; temp arr[i] arr i arr[i] = arr[j] arr[i] arr i arr[j] arr j arr[j] = temp arr[j] arr j temp Arrays.sort(arr) Arrays.sort Arrays arr double arr[] arr int n n static long mpow(long x, long n) {
        if(n == 0)
            return 1;
        if(n % 2 == 0) {
            long root = mpow(x, n / 2);
            return root * root % mod;
        }else {
            return x * mpow(x, n - 1) % mod;
        }
    } mpow {
        if(n == 0)
            return 1;
        if(n % 2 == 0) {
            long root = mpow(x, n / 2);
            return root * root % mod;
        }else {
            return x * mpow(x, n - 1) % mod;
        }
    } if(n == 0)
            return 1; n == 0 n 0 return 1; 1 if(n % 2 == 0) {
            long root = mpow(x, n / 2);
            return root * root % mod;
        }else {
            return x * mpow(x, n - 1) % mod;
        } n % 2 == 0 n % 2 n 2 0 {
            long root = mpow(x, n / 2);
            return root * root % mod;
        } long root = mpow(x, n / 2); root mpow(x, n / 2) mpow x n / 2 n 2 return root * root % mod; root * root % mod root * root root root mod {
            return x * mpow(x, n - 1) % mod;
        } return x * mpow(x, n - 1) % mod; x * mpow(x, n - 1) % mod x * mpow(x, n - 1) x mpow(x, n - 1) mpow x n - 1 n 1 mod long x x long n n static long mcomb(long a, long b) {
        if(b > a - b)
            return mcomb(a, a - b);
        long m = 1;
        long d = 1;
        long i;
        for(i = 0; i < b; i++) {
            m *= (a - i);
            m %= mod;
            d *= (i + 1);
            d %= mod;
        }
        long ans = m * mpow(d, mod - 2) % mod;
        return ans;
    } mcomb {
        if(b > a - b)
            return mcomb(a, a - b);
        long m = 1;
        long d = 1;
        long i;
        for(i = 0; i < b; i++) {
            m *= (a - i);
            m %= mod;
            d *= (i + 1);
            d %= mod;
        }
        long ans = m * mpow(d, mod - 2) % mod;
        return ans;
    } if(b > a - b)
            return mcomb(a, a - b); b > a - b b a - b a b return mcomb(a, a - b); mcomb(a, a - b) mcomb a a - b a b long m = 1; m 1 long d = 1; d 1 long i; i for(i = 0; i < b; i++) {
            m *= (a - i);
            m %= mod;
            d *= (i + 1);
            d %= mod;
        } i = 0; i = 0 i 0 i < b i b i++ i++ i {
            m *= (a - i);
            m %= mod;
            d *= (i + 1);
            d %= mod;
        } {
            m *= (a - i);
            m %= mod;
            d *= (i + 1);
            d %= mod;
        } m *= (a - i) m (a - i) a i m %= mod m mod d *= (i + 1) d (i + 1) i 1 d %= mod d mod long ans = m * mpow(d, mod - 2) % mod; ans m * mpow(d, mod - 2) % mod m * mpow(d, mod - 2) m mpow(d, mod - 2) mpow d mod - 2 mod 2 mod return ans; ans long a a long b b static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}} AnotherReader BufferedReader br; br StringTokenizer st; st AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));} AnotherReader {
    br=new BufferedReader(new InputStreamReader(System.in));} br=new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));} AnotherReader {
    br = new BufferedReader(new FileReader("input.txt"));} br = new BufferedReader(new FileReader("input.txt")) br new BufferedReader(new FileReader("input.txt")) int a a String next()throws IOException{
    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 nextInt() throws IOException{
    return Integer.parseInt(next());} nextInt {
    return Integer.parseInt(next());} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() throws IOException
    {return Long.parseLong(next());} nextLong {return Long.parseLong(next());} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble()throws IOException { return Double.parseDouble(next()); } nextDouble { return Double.parseDouble(next()); } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine() throws IOException{ 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
{
    
    public static void process()throws IOException
    {
        int n=ni();
        char arr[][]=new char[n+1][];

        for(int i=1;i<=n;i++) {arr[i]=(nln()).toCharArray(); Arrays.sort(arr[i]);}

        ArrayList<String> li = new ArrayList<>();

        for(int i=1;i<=n;i++) li.add(new String(arr[i]));

        Collections.sort(li);li.add(" ");
        String curr=li.get(0);
        //System.out.println(li);
        long cnt=0,res=0l;

        for(int i=0;i<=n;i++){
            if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            }
            cnt++;
        }
        pn(res);
    }


    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        //oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;
    static long mod=(long)1e9+7l;

    static void r_sort(double arr[],int n){
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            double temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    }

    static long mpow(long x, long n) {
        if(n == 0)
            return 1;
        if(n % 2 == 0) {
            long root = mpow(x, n / 2);
            return root * root % mod;
        }else {
            return x * mpow(x, n - 1) % mod;
        }
    }
    
    static long mcomb(long a, long b) {
        if(b > a - b)
            return mcomb(a, a - b);
        long m = 1;
        long d = 1;
        long i;
        for(i = 0; i < b; i++) {
            m *= (a - i);
            m %= mod;
            d *= (i + 1);
            d %= mod;
        }
        long ans = m * mpow(d, mod - 2) % mod;
        return ans;
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
} public class Main
{
    
    public static void process()throws IOException
    {
        int n=ni();
        char arr[][]=new char[n+1][];

        for(int i=1;i<=n;i++) {arr[i]=(nln()).toCharArray(); Arrays.sort(arr[i]);}

        ArrayList<String> li = new ArrayList<>();

        for(int i=1;i<=n;i++) li.add(new String(arr[i]));

        Collections.sort(li);li.add(" ");
        String curr=li.get(0);
        //System.out.println(li);
        long cnt=0,res=0l;

        for(int i=0;i<=n;i++){
            if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            }
            cnt++;
        }
        pn(res);
    }


    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        //oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;
    static long mod=(long)1e9+7l;

    static void r_sort(double arr[],int n){
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            double temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    }

    static long mpow(long x, long n) {
        if(n == 0)
            return 1;
        if(n % 2 == 0) {
            long root = mpow(x, n / 2);
            return root * root % mod;
        }else {
            return x * mpow(x, n - 1) % mod;
        }
    }
    
    static long mcomb(long a, long b) {
        if(b > a - b)
            return mcomb(a, a - b);
        long m = 1;
        long d = 1;
        long i;
        for(i = 0; i < b; i++) {
            m *= (a - i);
            m %= mod;
            d *= (i + 1);
            d %= mod;
        }
        long ans = m * mpow(d, mod - 2) % mod;
        return ans;
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
} Main
            
import java.util.*;import java.io.*;import java.math.*;

public class Main
{
    
    public static void process()throws IOException
    {
        int n=ni();
        char arr[][]=new char[n+1][];

        for(int i=1;i<=n;i++) {arr[i]=(nln()).toCharArray(); Arrays.sort(arr[i]);}

        ArrayList<String> li = new ArrayList<>();

        for(int i=1;i<=n;i++) li.add(new String(arr[i]));

        Collections.sort(li);li.add(" ");
        String curr=li.get(0);
        //System.out.println(li);
        long cnt=0,res=0l;

        for(int i=0;i<=n;i++){
            if(curr.compareTo(li.get(i))!=0){
                curr=li.get(i);
                //System.out.println(curr+" "+cnt);
                res+=(cnt*(cnt-1l)/2l);//System.out.println("res "+res);
                cnt=0;
            }
            cnt++;
        }
        pn(res);
    }


    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        //oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;
    static long mod=(long)1e9+7l;

    static void r_sort(double arr[],int n){
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            double temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    }

    static long mpow(long x, long n) {
        if(n == 0)
            return 1;
        if(n % 2 == 0) {
            long root = mpow(x, n / 2);
            return root * root % mod;
        }else {
            return x * mpow(x, n - 1) % mod;
        }
    }
    
    static long mcomb(long a, long b) {
        if(b > a - b)
            return mcomb(a, a - b);
        long m = 1;
        long d = 1;
        long i;
        for(i = 0; i < b; i++) {
            m *= (a - i);
            m %= mod;
            d *= (i + 1);
            d %= mod;
        }
        long ans = m * mpow(d, mod - 2) % mod;
        return ans;
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}