package boj_silver.p1316_그룹단위체커;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
public class Main {
public static void main(String[] args) throws IOException {
int cnt = 0;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
for (int i = 0; i< N ; i++) {
String line = br.readLine();
Set<Character> set = new HashSet<>();
boolean isTrue = true;
for (int j = 0; j < line.length(); j++) {
char c = line.charAt(j);
if (j > 0 && c != line.charAt(j - 1)) {
if (set.contains(c)) {
isTrue = false;
break;
}
}
set.add(c);
}
if (isTrue) cnt++;
}
System.out.println(cnt);
}
}