////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                    //
//	                                      Created by Aeren                                            //
//                                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                    //
//                                                                                                    //
//                                              ______________                                        //
//             ++++++++++                ___----------------------__                                  //
//           +++`+``+`+`++++        ///``````````````````````````````\\\                              //
//           ++`+`+``+++`++++  /////```````````````````````````````````\\\                            //
//           +++`++`+`+``+++/////````````````````````````````````````````\\\                          //
//             +++`++`+``+///```````````|````````` ````````````````````````\\\                        //
//          ____++++/++++/`````````````/````````|````````|```````````````````\\                       //
//        /    / /|    //``````````````|````````|```````|`````````````````````\\                      //
//       |   /  //| ///````````/```````|```````||```````|````````|``````````````\\                    //
//        \ /_/ / |///.````````|``````/````````|````````|````````|````````.````` \                    //
//        /|\_|_/ |-...````````|``````|````````|`````````|`````.`|````````````````\                   //
//       / \__|__/--...````````|.````|````````:|````````|:`````::|::`````|`````````|                  //
//      /     /  /:...````````|/`    |        :|        :|       |```````|``++````++                  //
//      |    / //::...````````|      |        |:        :|       |       |```++``++||                 //
//     /    /  /-:-`..````````/    _.::::.    |         :       :        |``` `++``||                 //
//     |   /  --:-.`.-```````|            ``           `       `        `|```++``++`|                 //
//     |  /    /:-....```````|                                           |``++````++|                 //
//     | /     /-....````````|                              _.-:::.      |..````.`..|                 //
//     |/     /-.````````````.                                     `     .``````.`.`|\                //
//    /|      |-``````````````                    :'                    .|`````````.||                //
//   / |     `|.`````````````.                                         -|-|`````````\\                //
//  /  |     `|````.`````````-                                        --||`````````.|\\               //
//            |``````````````|::                                    :..-||`````````|``|               //
//			  \\`````````````|:::.        `...                    .\___/-|`````````|``|               //
//			  \\`````````````|::::-           `:::....           --::/:::|`````````.``\               //
//			   \\````````````|::::`|.                          .:::/:::::-|````````|``|               //
//      	    \```.````````|::::/|--.                     .-:/:::/:::::/````````//``\               //
//      	     \\`.````````-:::|`|-----              ..-:|:::/::::::::|-``/|````/  `\`              //
//      	      \`.````````-|:::\|-----`-.___......------/:::/::::::::|.`//|```/     \              //
//                 \\-```|\````|```\_________````__________/\---::::::::|                             //
//                  .\.``| \```|```....-.---`\`./:-:--...````\`.\\\:::::|                             //
//                  __\``|_/\``|------------:-\/-----::-..````\_________|__                           //
//                                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////////////////////

#include<bits/stdc++.h>
#include<chrono>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace chrono;
#define all(a) a.begin(), a.end()
#define sz(x) (int(x.size()))
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef vector<string> vs;
template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<string> a(n);
	for(int i = 0; i < n; i ++){
		cin >> a[i];
		sort(all(a[i]));
	}
	sort(all(a));
	vl d({1});
	for(int i = 1; i < n; i ++){
		if(a[i] == a[i - 1]){
			d.back() ++;
		}
		else{
			d.push_back(1);
		}
	}
	cout << accumulate(all(d), 0LL, [](ll x, ll y){return x + y * (y - 1) / 2;});
	return 0;
}

Measured memory_bytes: 6908