import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int testcase = sc.nextInt();
int count = testcase;
String text= "";
for (int i = 0 ; i < testcase ; i ++) {
text = sc.next();
int temp = -1;
int index = -1;
boolean[] array = new boolean[26];
for (int j = 0 ; j < text.length(); j ++) {
if(text.length() == 1 ) {
break;
}
index = (int) text.charAt(j) - (int)'a';
if( index != temp ) {
temp = index;
if(array[temp] == true) {
count --;
break;
}
array[temp] = true;
}
}
}
System.out.println(count);
}
}