public static int solve(String s1, String s2){
int maxCount = 0;
for(int i = 0; i < s2.length(); i += 1){
int count = 0;
int index = 0;
for (int j = 0; j < s1.length(); j++) {
if(index+i > s2.length()-1){
maxCount = maxCount < count? count:maxCount;
break;
}
if(s1.charAt(j) == s2.charAt(i+index)){
++count;
++index;
}else{
count = 0;
index = 0;
}
maxCount = maxCount < count? count:maxCount;
}
}
return maxCount;
}
public static boolean solve(ArrayList<Map<Character,Integer>> a, String s){
for (int i = 0; i < a.size(); i++) {
Map<Character,Integer> m = new HashMap<>(a.get(i));
boolean flag = false;
for (int j = 0; j < s.length(); j++) {
if(m.containsKey(s.charAt(j))){
int v = m.get(s.charAt(j));
if(v <= 1){
m.remove(s.charAt(j));
}else{
m.put(s.charAt(j), m.get(s.charAt(j)-1));
}
}else{
flag = true;
break;
}
}
if(m.isEmpty() && !flag){
return true;
}
}
return false;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int count = 0;
ArrayList<Map<Character,Integer>> a = new ArrayList<>();
for (int i = 0; i < n; i++) {
String s = sc.next();
if(!solve(a,s)){
++count;
Map<Character,Integer> map = new HashMap<>();
for (int j = 0; j < s.length(); j++) {
char key = s.charAt(j);
if(map.containsKey(key)){
map.put(key, map.get(key)+1);
}else{
map.put(key, 1);
}
}
a.add(map);
}
}
System.out.println(count);
}