Language: C++

#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
    #define lb lower_bound 
    #define ub upper_bound
    #define pii pair<pair<int,int>,pair<int,int> >
	#define se second
	#define endl "\n"
	#define pi pair<int, int>
	#define vi vector<int> 
	#define vvi vector<vi>
    #define bs   binary_search
	#define rep(i,a,b) for(int i=a;i<b;i++)
	#define rep1(i,a,b) for(int i=a;i<=b;i++)	
    #define all(c) (c).begin(),(c).end()
    #define sz(x)       (int)x.size() 
	#define PI 3.14159265358979323846
    
	const int N =1e6;
    
     int mod= 1e9+7;
     
     int dx[4]={0,0,+1,-1};
     int dy[4]={+1,-1,0,0};
   
     void solve(){
          
          int q;
          cin>>q;
          
          map<vi,int > mp;          
          int sum=0,mx=0;
          
          while(q--){
			   string s;
			   cin>>s;
			   vi h(26,0);
			  rep(i,0,sz(s))
			    h[s[i]-'a']++;
			  mp[h]++;			 		 	   
		  }
		  
		  for(auto it:mp){
			  int yan = it.se;
			  sum+=yan*(yan-1)/2; 
		  }
		   
		  
		  //int wyn=mx*(mx-1)/2;
		  cout<<sum<<endl;  
           
     }
   
   
   
   
      int32_t main() {
	    cool;
	    int t=1;
        //cin>>t;
	    while(t--)
	       solve();
	       
	       
	       return 0;	   
	   }
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
    #define lb lower_bound 
    #define ub upper_bound
    #define pii pair<pair<int,int>,pair<int,int> >
	#define se second
	#define endl "\n"
	#define pi pair<int, int>
	#define vi vector<int> 
	#define vvi vector<vi>
    #define bs   binary_search
	#define rep(i,a,b) for(int i=a;i<b;i++)
	#define rep1(i,a,b) for(int i=a;i<=b;i++)	
    #define all(c) (c).begin(),(c).end()
    #define sz(x)       (int)x.size() 
	#define PI 3.14159265358979323846
    
	const int N =1e6;
    
     int mod= 1e9+7;
     
     int dx[4]={0,0,+1,-1};
     int dy[4]={+1,-1,0,0};
   
     void solve(){
          
          int q;
          cin>>q;
          
          map<vi,int > mp;          
          int sum=0,mx=0;
          
          while(q--){
			   string s;
			   cin>>s;
			   vi h(26,0);
			  rep(i,0,sz(s))
			    h[s[i]-'a']++;
			  mp[h]++;			 		 	   
		  }
		  
		  for(auto it:mp){
			  int yan = it.se;
			  sum+=yan*(yan-1)/2; 
		  }
		   
		  
		  //int wyn=mx*(mx-1)/2;
		  cout<<sum<<endl;  
           
     }
   
   
   
   
      int32_t main() {
	    cool;
	    int t=1;
        //cin>>t;
	    while(t--)
	       solve();
	       
	       
	       return 0;	   
	   }


Compiler output:
a.cc:105:14: error: redefinition of 'struct rge<c>'
  105 | sim > struct rge { c b, e; };
      |              ^~~
a.cc:8:14: note: previous definition of 'struct rge<c>'
    8 | sim > struct rge { c b, e; };
      |              ^~~
a.cc:106:14: error: redefinition of 'template<class c> rge<c> range(c, c)'
  106 | sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
      |              ^~~~~
a.cc:9:14: note: 'template<class c> rge<c> range(c, c)' previously declared here
    9 | sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
      |              ^~~~~
a.cc:109:8: error: redefinition of 'struct debug'
  109 | struct debug {
      |        ^~~~~
a.cc:12:8: note: previous definition of 'struct debug'
   12 | struct debug {
      |        ^~~~~
a.cc:147:19: error: redefinition of 'const long long int N'
  147 |         const int N =1e6;
      |                   ^
a.cc:50:19: note: 'const long long int N' previously defined here
   50 |         const int N =1e6;
      |                   ^
a.cc:149:10: error: redefinition of 'long long int mod'
  149 |      int mod= 1e9+7;
      |          ^~~
a.cc:52:10: note: 'long long int mod' previously defined here
   52 |      int mod= 1e9+7;
      |          ^~~
a.cc:151:10: error: redefinition of 'long long int dx [4]'
  151 |      int dx[4]={0,0,+1,-1};
      |          ^~
a.cc:54:10: note: 'long long int dx [4]' previously defined here
   54 |      int dx[4]={0,0,+1,-1};
      |          ^~
a.cc:152:10: error: redefinition of 'long long int dy [4]'
  152 |      int dy[4]={+1,-1,0,0};
      |          ^~
a.cc:55:10: note: 'long long int dy [4]' previously defined here
   55 |      int dy[4]={+1,-1,0,0};
      |          ^~
a.cc:154:11: error: redefinition of 'void solve()'
  154 |      void solve(){
      |           ^~~~~
a.cc:57:11: note: 'void solve()' previously defined here
   57 |      void solve(){
      |           ^~~~~
a.cc:185:15: error: redefinition of 'int32_t main()'
  185 |       int32_t main() {
      |               ^~~~
a.cc:88:15: note: 'int32_t main()' previously defined here
   88 |       int32_t main() {
      |               ^~~~