#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <iterator>
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
const string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
char alphabetArr[52];
bool isPair(string a, string b){
map<char, char> mapA;
map<char, char> mapB;
std::map<char, char>::iterator it;
char arrA[a.length() + 1];
char arrB[b.length() + 1];
string newA;
string newB;
strcpy(arrA, a.c_str());
strcpy(arrB, b.c_str());
for (int i = 0; i < a.length() + 1; i++){
if(mapA.find(arrA[i]) != mapA.end()){
cout << mapA.find(arrA[i]);
newA = newA + std::string(1, 'a');
}else{
newA = newA + std::string(1, 'a');
mapA.insert(std::pair<char,char>(alphabetArr[mapA.size()], end(mapA)));
}
}
for (int i = 0; i < b.length() + 1; i++){
it = mapB.find(arrB[i]);
if(it != mapB.end()){
newB += string(1, 'a');
}else{
newB += string(1, 'a');
mapB.insert(alphabetArr[mapB.size()], mapB.end());
}
}
}
int main(){
int num;
int amount = 0;
cin >> num;
strcpy(alphabetArr, alphabet.c_str());
string arr[num];
for (int i = 0; i < num; i++){
cin >> arr[i];
}
for (int i = 0; i < num; i++){
for (int j = 0; j < num; j++){
if(isPair(arr[i], arr[j])){
amount++;
}
}
}
cout << amount/2; //Jaetaan kahdella, koska jokainen käydään läpi 2 kertaa
return 0;
}