#include<cstdio>
#include<memory.h>
const int M = 26;
int pivot[M];
int pivot_tot;
int cmp[M];
int cmp_tot;
int ab2(int a) { return (a > 0) ? a : -a; }
int main() {
int n, ans = 0;
char input[1 << 4];
scanf("%d", &n);
memset(input, 0x00, sizeof(input));
scanf("%s", input);
for (int i = 0; input[i] != NULL; i++) {
pivot[input[i] - 'A']++;
pivot_tot++;
}
for (int i = 0; i < n-1; i++) {
memset(input, 0x00, sizeof(input));
memset(cmp, 0x00, sizeof(cmp));
scanf("%s", input);
cmp_tot = 0;
for (int s = 0; input[s] != NULL; s++) {
cmp[input[s] - 'A']++;
cmp_tot++;
}
bool ok = false;
int check = 0;
if (pivot_tot == cmp_tot) { // change
bool change = false;
bool change_end = false;
for (int s = 0; s < M; s++) {
if (pivot[s] == cmp[s]) continue;
if ((pivot[s] - 1 == cmp[s]) && !change) change = true;
else if ((pivot[s] + 1 == cmp[s]) && !change) change = true;
else if (!change_end && change && (pivot[s] + 1 == cmp[s])) change_end = true;
else if (!change_end && change && (pivot[s] == cmp[s] + 1)) change_end = true;
else check++;
}
if(check == 0) ok = true;
}
else if(pivot_tot > cmp_tot) { // delete
if (pivot_tot - 1 != cmp_tot) continue;
for (int s = 0; s < M; s++) {
if (pivot[s] == cmp[s]) continue;
if (pivot[s] - 1 == cmp[s]) check++;
}
if (check == 1) ok = true;
}
else if (pivot_tot < cmp_tot) { // add
if (pivot_tot + 1 != cmp_tot) continue;
for (int s = 0; s < M; s++) {
if (pivot[s] == cmp[s]) continue;
if (pivot[s] + 1 == cmp[s]) check++;
else check += ab2(pivot[s] - cmp[s]);
}
if (check == 1) ok = true;
}
if (ok) {
ans++;
}
}
printf("%d\n", ans);
return 0;
}