#include <stdio.h>
#include <string.h>
int main() {
int N;
scanf("%d", &N);
int count = 0;
for (int i = 0; i < N; i++) {
char word[101];
int alpha[26] = { 0, };
int flag = 1;
scanf("%s", word);
int length = strlen(word);
for (int j = 0; j < length; j++) {
//printf("%c: %d\n", word[i],alpha[word[i] - 97]);
if (alpha[word[j] - 97] == 0) {
alpha[word[j] - 97] = 1;
}
else {
//printf("i = %d, word[i] = %c\n", i, word[i]);
if (word[j - 1] == word[j]) {
continue;
}
else {
flag = 0;
break;
}
}
}
if (flag) count++;
}
printf("%d", count);
return 0;
}