/*
ID: Aman Raj
LANG: C++
TASK: subset
*/
#include<iostream>
#include <stdio.h>
//#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<math.h>
typedef  long long int ll;
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
//#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define flush fflush(stdout)
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <fstream>
// find_by_order()  // order_of_key
typedef tree<
	int,
	null_type,
	less<int>,
	rb_tree_tag,
	tree_order_statistics_node_update>
	ordered_set;
  //# define mod 1e9+7
# define INF 100000000
bool comp (vector<ll> v1 , vector<ll> v2  )
{  ll i=0;

      while(i<26)
      {
          if(v1[i]==v2[i]){i++;continue;  }
          return v1[i] <  v2[i];
      }
     return v1[25] < v2[25];

}
bool aman(vector<ll> v1, vector<ll> v2)
{
    bool ok=true;
     for(ll i=0;i<26;i++)
     {
         if(v1[i]!=v2[i])return false;
     }
     return true;
}
int main()
{
     ll n;
       cin>>n;
         vector<string> v(n);
          for(ll i=0;i<n;i++)cin>>v[i];
          vector<vector<ll> > vcalc(n,vector<ll> (26,0)   );
          for(ll i=0;i<n;i++)
          {
              for(ll j=0;j<v[i].size();j++)
              {
                  ll a=v[i][j]-'a';
                   vcalc[i][a]++;
              }
          }
          ll ans=0;
          /*for(ll i=0;i<n;i++)
          {
              for(ll j=0;j<vcalc[i].size();j++)
              {
                  cout<<vcalc[i][j]<<" ";
              }
              cout<<endl;
          }*/

          sort(vcalc.begin(),vcalc.end(),comp  );

           ll a=1;
          for(ll i=0;i<n;i++)
          {   if(i==n-1)
              { ans+=a*(a-1)/2;
                 a=1;
               break;
              }
              if(aman(vcalc[i],vcalc[i+1])){ a++;}
              else
              {
                  ans+=a*(a-1)/2;
                  a=1;
              }
          }
            cout<<ans;
      return 0;
}


Measured memory_bytes: 31488