#include <bits/stdc++.h>
using namespace std;
unsigned int fact(unsigned int i){
if(i == 0){
return 1;
}
return i * fact(i-1);
}
char* convert(char* temp){
static char arr[50];
map<char, int> keys;
int o = 0;
for(int i = 0; i < strlen(temp); i++){
auto it = keys.find(temp[i]);
int p = -1;
if(it == keys.end()){
p=o;o++;
keys.insert(pair<char,int>(temp[i], p));
} else {
p = it->second;
}
arr[i] = (char)(p+64);
//cout << "i: " << i << " p:" << p << endl;
}
return arr;
}
bool error = false;
int main(){
int amount;
cin >> amount;
multiset<vector<char>> found;
int pairs = 0;
for(int i = 0; i < amount; i++){
char temp[50];
cin >> temp;
char *test = convert(temp);
vector<char> vec(test, test + strlen(temp));
/*if(found.find(vec) != found.end()){
pairs+=found.count(vec);
}*/
found.insert(vec);
}
for(auto el = found.begin(); el != foundend(); el = found.upper_bound(*el)){
int cou = setit.count(*el);
if(cou > 1){
pairs+=(fact(cou)/(2*fact(cou-2)));
}
}
cout << pairs << endl;
}