#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <iterator>
#include <unordered_map>
using namespace std;
const string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
char alphabetArr[54];
/*
bool isPair(const string a = 0, const string b = 0) {
std::unordered_map<char, char> mapA;
std::unordered_map<char, char> mapB;
std::unordered_map<char, char>::iterator it;
char arrA[50];
char arrB[50];
string newA;
string newB;
strcpy_s(arrA, a.c_str());
strcpy_s(arrB, b.c_str());
for (int i = 0; i < (int)a.size(); i++) {
if (mapA.find(arrA[i]) != mapA.end()) {
newA = newA + std::string(1, mapA.find(arrA[i])->second);
}
else {
newA = newA + std::string(1, alphabetArr[(int)mapA.size()]);
mapA.insert(std::pair<char, char>(arrA[i], alphabetArr[(int)mapA.size()]));
}
}
for (int i = 0; i < (int)b.size(); i++) {
if (mapB.find(arrB[i]) != mapB.end()) {
newB = newB + std::string(1, mapB.find(arrB[i])->second);
}
else {
newB = newB + std::string(1, alphabetArr[(int)mapB.size()]);
mapB.insert(std::pair<char, char>(arrB[i], alphabetArr[(int)mapB.size()]));
}
}
return (newA == newB);
}
*/
string toFormat(const string in) {
std::unordered_map<char, char> mapStr;
std::unordered_map<char, char>::iterator it;
char arrStr[50];
string newStr;
strcpy_s(arrStr, in.c_str());
for (int i = 0; i < (int)in.size(); i++) {
if (mapStr.find(arrStr[i]) != mapStr.end()) {
newStr = newStr + std::string(1, mapStr.find(arrStr[i])->second);
}
else {
newStr = newStr + std::string(1, alphabetArr[(int)mapStr.size()]);
mapStr.insert(std::pair<char, char>(arrStr[i], alphabetArr[(int)mapStr.size()]));
}
}
return newStr;
}
int main() {
int num;
int amount = 0;
strcpy_s(alphabetArr, alphabet.c_str());
string arr[5000];
string newArr[5000];
cin >> num;
for (int i = 0; i < num; i++) {
cin >> arr[i];
}
for (int i = 0; i < num; i++) {
newArr[i] = toFormat(arr[i]);
};
for (int i = 0; i < num; i++)
{
for (int j = i + 1; j < num; j++)
{
if (newArr[i] == newArr[j])
{
amount++;
break;
}
}
}
cout << amount;
return 0;
}