One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of n passwords — strings, consists of small Latin letters.

Hacker went home and started preparing to hack AtForces. He found that the system contains only passwords from the stolen list and that the system determines the equivalence of the passwords a and b as follows:

  * two passwords a and b are equivalent if there is a letter, that exists in both a and b; 
  * two passwords a and b are equivalent if there is a password c from the list, which is equivalent to both a and b. 



If a password is set in the system and an equivalent one is applied to access the system, then the user is accessed into the system.

For example, if the list contain passwords "a", "b", "ab", "d", then passwords "a", "b", "ab" are equivalent to each other, but the password "d" is not equivalent to any other password from list. In other words, if:

  * admin's password is "b", then you can access to system by using any of this passwords: "a", "b", "ab"; 
  * admin's password is "d", then you can access to system by using only "d". 



Only one password from the list is the admin's password from the testing system. Help hacker to calculate the minimal number of passwords, required to guaranteed access to the system. Keep in mind that the hacker does not know which password is set in the system.

Input

The first line contain integer n (1 ≤ n ≤ 2 ⋅ 10^5) — number of passwords in the list. Next n lines contains passwords from the list – non-empty strings s_i, with length at most 50 letters. Some of the passwords may be equal.

It is guaranteed that the total length of all passwords does not exceed 10^6 letters. All of them consist only of lowercase Latin letters.

Output

In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.

Examples

Input


4
a
b
ab
d


Output


2

Input


3
ab
bc
abc


Output


1

Input


1
codeforces


Output


1

Note

In the second example hacker need to use any of the passwords to access the system.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

//import graph_representation.edge;
public class hacker49 {
	public static int r1=0;
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
static 	ArrayList<Integer>[] f=new ArrayList[200001];

	static HashMap<Long,Integer> e=new HashMap<>();
	public static void main(String[] args) {
		OutputStream outputStream =System.out;
	    PrintWriter out =new PrintWriter(outputStream);
		FastReader s=new FastReader();
int n=s.nextInt();
for(int i=0;i<=26;i++) {
	f[i]=new ArrayList<>();
	
}
for(int i=1;i<=n;i++) {
	String str=s.next();
	int x=(int)(str.charAt(0)-'a');
	f[x].add(x);
	for(int j=1;j<str.length();j++) {
	
		int y=(int)(str.charAt(j)-'a');
		if(!f[x].contains(y)) {
			f[x].add(y);
			f[y].add(x);
		}
		}
	}

int count=0;
	for(int i=0;i<26;i++) {
		if(vis[i]==0 && f[i].size()>0) {
			dfs(i);
			count++;
		}
	}
	out.println(count);
		out.close();
		
	}
//	static int[] vis=new int[200001];
	static void dfs(int node) {
		vis[node]=1;
		for(int i=0;i<f[node].size();i++) {
			if(vis[f[node].get(i)]==0 && f[node].get(i)!=node) {
				dfs(f[node].get(i));
			}
		}
	}
	static int LongestPalindromicPrefix(String str)
	{
	  
	    // Create temporary String
	    String temp = str + '?';
	  
	    // Reverse the String str
	    str = reverse(str);
	  
	    // Append String str to temp
	    temp += str;
	  
	    // Find the length of String temp
	    int n = temp.length();
	  
	    // lps[] array for String temp
	    int []lps = new int[n];
	  
	    // Intialise every value with zero
	    Arrays.fill(lps, 0);
	  
	    // Iterate the String temp
	    for(int i = 1; i < n; i++)
	    {
	          
	       // Length of longest prefix
	       // till less than i
	       int len = lps[i - 1];
	         
	       // Calculate length for i+1
	       while (len > 0 && temp.charAt(len) != 
	                         temp.charAt(i)) 
	       {
	           len = lps[len - 1];
	       }
	         
	       // If character at current index
	       // len are same then increament
	       // length by 1
	       if (temp.charAt(i) == temp.charAt(len))
	       {
	           len++;
	       }
	         
	       // Update the length at current
	       // index to len
	       lps[i] = len;
	    }
	  
	    // Print the palindromic String 
	    // of max_len
//	    System.out.print(temp.substring(0, lps[n - 1]));
	return lps[n-1];
	}
	  
	static String reverse(String input)
	{
	    char[] a = input.toCharArray();
	    int l, r = a.length - 1;
	      
	    for(l = 0; l < r; l++, r--)
	    {
	       char temp = a[l];
	       a[l] = a[r];
	       a[r] = temp;
	    }
	    return String.valueOf(a);
	}
	public static void lps(String str,TreeSet<Integer>[] f,int n,TreeSet<Integer>[] f2) {
		boolean[][] dp=new boolean[n][n];
		for(int g=0;g<n;g++) {
			for(int i=0,j=g;j<n;i++,j++) {
				if(g==0) {
					dp[i][j]=true;
				}else if(g==1) {
					if(str.charAt(i)==str.charAt(j)) {
						dp[i][j]=true;
					}else {
						dp[i][j]=false;
					}
				}else {
					if(str.charAt(i)==str.charAt(j) && dp[i+1][j-1]) {
						dp[i][j]=true;
					}else {
						dp[i][j]=false;
					}
				}
				if(dp[i][j]) {
					f[i].add(j);
					f2[n-j-1].add(n-i-1);
				}
			}
		}
			
	}
	static int[] vis=new int[200001];
	
static int[] is_prime=new int[1001];
static ArrayList<Integer>[] y=new ArrayList[100001];
	public static ArrayList<Integer> primes=new ArrayList<>();
 	public static void sieve() {
		long maxN=1000;
		for(int i=1;i<=maxN;i++) {
			is_prime[i]=1;
		}
		is_prime[0]=0;
		is_prime[1]=0;
		for(long i=2;i*i<=maxN;i++) {
			if(is_prime[(int) i]==1) {
//				primes.add((int) i);
				for(long j=i*i;j<=maxN;j+=i) {
					is_prime[(int) j]=0;
				}
			}
		}
//		for(int i=1;i<=1000000;i++) {
//			pre[i]=pre[i-1]+is_prime[i];
//		}
		for(int i=0;i<=maxN;i++) {
			if(is_prime[i]==1) {
				primes.add(i);
			}
		}
//		int count=0;
//		for(long i=1;i<=maxN;i++) {
//			if(is_prime[(int) i]==1) {
//				count++;
//			}
//			if(is_prime[count]==1) {
//				arr[(int) i]=1;
//			}else {
//				arr[(int)i]=0;
//			}
//		}
	}
 	
 	static boolean isgood(long k) {
 		boolean p=true;
 		out:while(k>1) {
 			while(k%3==0 && k>1) {
 				k/=3;
 			}
 			if(k==1) {
 				break out;
 			}
 			k-=1;
 			if(k%3!=0) {
 				p=false;
 				break out;
 			}
 		}
 		return p;
 		
 	}
	static int[] r=new int[100001];
	static class pair5{
		private int a;
		private int b;
		pair5(int a,int b){
			this.a=a;
			this.b=b;
		}
	}
	static ArrayList<Integer> o=new ArrayList<>();
	static void bfs(int node) {
		PriorityQueue<Integer> q=new PriorityQueue<>();
		q.add(1);
//	o.add(1);
	vis[1]=1;
    while(!q.isEmpty()) {
    	int g=q.poll();
//    	vis[g]=1;
    	o.add(g);
    	for(int i=0;i<y[g].size();i++) {
    		if(vis[y[g].get(i)]==0) {
    			q.add(y[g].get(i));
    			vis[y[g].get(i)]=1;
    		}
    	}
    }
		
	}
	static int[] dx= {0,-1,0,1};
	static int[] dy= {1,0,-1,0};
	static boolean is(int x,int y,int n,int m) {
		if(x<=n && x>=1 && y<=m && y>=1) {
			return true;
			
		}
		return false;
	}
//	static ArrayList<pair5>[] t=new ArrayList[51];
	
	static class pair implements Comparable<pair>{
		private long i;
		private long v;
		pair(long i,long v){
			this.i=i;
			this.v=v;
		}
		public int compareTo(pair o) {
//			if(o.v<this.v) {
//				return -1;
//			}else {
//				return 1;
//			}
			return Long.compare(this.v, o.v);
		}
		
	}
	
	static int nextPowerOf2(int n) 
	{ 
	    n--; 
	    n |= n >> 1; 
	    n |= n >> 2; 
	    n |= n >> 4; 
	    n |= n >> 8; 
	    n |= n >> 16; 
	    n++; 
	      
	    return n; 
	} 
//	static class node{
//		private int a;
//		private int b;
//		private int c;
//		private int d;
//		
//	}
	
	
	public static class node{
		private int a;
		private int b;
		node(int a,int b){
			this.a=a;
			this.b=b;
		}
	}

	public static long GCD(long a,long b) {
		if(b==(long)0) {
			return a;
		}
		return GCD(b , a%b);
	}
//	public static void Create(node[] arr,node[] segtree,int low,int high,int pos) {
//		if(low==high) {
//			segtree[pos]=arr[low];
//			return;
//		}
//		int mid=(low+high)/2;
//		Create(arr,segtree,low,mid,2*pos+1);
//		Create(arr,segtree,mid+1,high,2*pos+2);
//		if(segtree[2*pos+1].a+segtree[2*pos+2].a>=10) {
//			int a=segtree[2*pos+1].a;
//			int b=segtree[2*pos+2].a;
//			int c=segtree[2*pos+1].b;
//			int d=segtree[2*pos+2].b;
//			segtree[pos]=new node((a+b)%10,1+c+d);
//		}else {
//			int a=segtree[2*pos+1].a;
//			int b=segtree[2*pos+2].a;
//			int c=segtree[2*pos+1].b;
//			int d=segtree[2*pos+2].b;
//			segtree[pos]=new node(a+b,c+d);
//			
//		}
//	}
//	public static node Query(node[] segtree,int qlow,int qhigh,int low,int high,int pos) {
//		if(low>=qlow && high<=qhigh) {
//			return segtree[pos];
//		}
//		if(qhigh<low || qlow>high) {
//			return new node(0,0);
//		}
//		int mid=(low+high)/2;
//	 node a=Query(segtree,qlow,qhigh,low,mid,2*pos+1);
//	node b=Query(segtree,qlow,qhigh,mid+1,high,2*pos+2);
//	int c=a.a;
//	int d=b.a;
//	if(c+d>=10) {
//	node e=new node((c+d)%10,1+a.b+b.b);
//	return e;
//	}else {
//		node e=new node(c+d,a.b+b.b);
//		return e;
//	}
//	}
//	
	static class pair1 implements Comparable<pair1>{
		private int a;
		private int b;
		private int c;
		private int d;
		pair1(int a,int b,int c,int d){
			this.a=a;
			this.b=b;
			this.c=c;
			this.d=d;
		}
		public int compareTo(pair1 o) {
			if(this.a<o.a) {
				return 1;
			}else if(this.a==o.a) {
				if(this.b<o.b) {
					return 1;
				}else {
					return -1;
				}
			}else {
				return -1;
			}
				
		}
	}
	public static void update(long[] segtree,int low,int high,int qlow,int qhigh,long val,int pos) {
		if(qlow>high || qhigh<low) {
			return ;
		}
		if(low>=qlow &&qhigh>=high) {
			segtree[pos]+=val;
			return;
		}
		int mid=(low+high)/2;
		update(segtree,low,mid,qlow,qhigh,val,2*pos);
		update(segtree,mid+1,high,qlow,qhigh,val,2*pos+1);
		
	}
	public static long query(long[] segtree,int low,int high,int index,int pos) {
		
		if(low==high) {
			return segtree[pos];
		}
		int mid=(low+high)/2;
		long res=0;
		if(index<=mid) {
			res= query(segtree,low,mid,index,2*pos);
		}else {
			res=query(segtree,mid+1,high,index,2*pos+1);
		}
		return res+segtree[pos];
	}
	
//	public static class pair5{
//		private int a;
//		private int b;
//		pair5(int a,int b){
//			this.a=a;
//			this.b=b;
//		}
//		public int compareTo(pair5 o) {
//			return Integer.compare(o.b, this.b);
//		}
//	}
//	public static pair5[] merge_sort(pair5[] A, int start, int end) {
//		if (end > start) {
//			int mid = (end + start) / 2;
//			pair5[] v = merge_sort(A, start, mid);
//			pair5[] o = merge_sort(A, mid + 1, end);
//			return (merge(v, o));
//		} else {
//			pair5[] y = new pair5[1];
//			y[0] = A[start];
//			return y;
//		}
//	}
//	public static pair5[] merge(pair5 a[], pair5 b[]) {
////		int count=0;
//		pair5[] temp = new pair5[a.length + b.length];
//		int m = a.length;
//		int n = b.length;
//		int i = 0;
//		int j = 0;
//		int c = 0;
//		while (i < m && j < n) {
//			if (a[i].a < b[j].a) {
//				temp[c++] = a[i++];
//			} else {
//				temp[c++] = b[j++];
//			}
//		}
//		while (i < m) {
//			temp[c++] = a[i++];
//		}
//		while (j < n) {
//			temp[c++] = b[j++];
//		}
//		return temp;
//	}
////	
	public static int upper_bound(int[] a ,int n,int x) {
		int l=-1;
		int r=n;
		while(r>l+1) {
			int mid=(l+r)/2;
			if(a[mid]<x) {
				l=mid;
			}else {
				r=mid;
			}
		}
		return r;
				
	}

//	
//	
	public static long lower_bound(long n,long i) {
		long l=0;
		long r=n+1;
		while(r>l+1) {
			long mid=(l+r)/2;
//			System.out.println(mid);
//			mid*=mid;
			long y=2*mid-1;
			long r1=(y*y);
			if((r1-1)/2<i) {
				l=mid;
			}else {
				r=mid;
			}
//			System.out.println(l);
//			if(a[mid].i<x) {
//				l=mid;
//			}else {
//				r=mid;
//			}
		}
		return l;
				
	}
	public static int ty(int[] a, int x, int y)
    {
        Arrays.sort(a);
        int count=0;
        int n=a.length;
        for(int i=0;i<n;i++) {
        	int g=0;
        	if(x%a[i]==0) {
        		g=x/a[i];
        	}else {
        		g=x/a[i]+1;
        	}
        	int k1=upper_bound(a,n,g);
        	if(k1==n) {
        		count+=0;
        	}else {
        		int g1=0;
            	if(y%a[i]==0) {
            		g1=y/a[i];
            	}else {
            		g1=y/a[i]+1;
            	}
//            	int k2=lower_bound(a,n,g1);
//            	if(k2>=k1) {
//            		count+=(k2-k1+1);
//            	}
        	}
//        System.out.println(count);
        }
        return count;
        
    }
	static boolean isValid(int x,int y,int n,int m) {
		if(x>=1 && x<=n && y>=1 && y<=m) {
			return true;
		}else {
			return false;
		}
	}
	
	static long[] fac=new long[1000001];
	static void fac() {
		fac[0]=1;
		for(int i=1;i<=1000000;i++) {
//			fac[i]=((fac[i-1]%mod)*(i%mod))%mod;
		}
	}

	public static void init(int n) {
		
		for(int j=1;j<=n;j++) {
		for (int l=1; l<=Math.sqrt(j); l++)
        {
            if (j%l==0)
            {
                // If divisors are equal, print only one
                if (j/l == l) {
                    f[j].add(l);}
      
                else { // Otherwise print both
//                    System.out.print(i+" " + n/i + " " );
            f[j].add(l);
            f[j].add(j/l);
                }
                
            }
        }
		
		}
		
	}
	
	public static long[] merge_sort(long[] A, int start, int end) {
		if (end > start) {
			int mid = (end + start) / 2;
			long[] v = merge_sort(A, start, mid);
			long[] o = merge_sort(A, mid + 1, end);
			return (merge(v, o));
		} else {
			long[] y = new long[1];
			y[0] = A[start];
			return y;
		}
	}
	public static long[] merge(long a[], long b[]) {
//		int count=0;
		long[] temp = new long[a.length + b.length];
		int m = a.length;
		int n = b.length;
		int i = 0;
		int j = 0;
		int c = 0;
		while (i < m && j < n) {
			if (a[i] > b[j]) {
				temp[c++] = a[i++];
			
			} else {
				temp[c++] = b[j++];
			}
		}
		while (i < m) {
			temp[c++] = a[i++];
		}
		while (j < n) {
			temp[c++] = b[j++];
		}
		return temp;
	}
	
	public static int[] merge_sort1(int[] A, int start, int end) {
		if (end > start) {
			int mid = (end + start) / 2;
			int[] v = merge_sort1(A, start, mid);
			int[] o = merge_sort1(A, mid + 1, end);
			return (merge1(v, o));
		} else {
			int[] y = new int[1];
			y[0] = A[start];
			return y;
		}
	}
	public static int[] merge1(int a[], int b[]) {
//		int count=0;
		int[] temp = new int[a.length + b.length];
		int m = a.length;
		int n = b.length;
		int i = 0;
		int j = 0;
		int c = 0;
		while (i < m && j < n) {
			if (a[i] < b[j]) {
				temp[c++] = a[i++];
			
			} else {
				temp[c++] = b[j++];
			}
		}
		while (i < m) {
			temp[c++] = a[i++];
		}
		while (j < n) {
			temp[c++] = b[j++];
		}
		return temp;
	}
	
	static long MOD=1000000007;
	static class pair2{
		private long a;
		private int b;
		pair2(long a,int b){
			this.a=a;
			this.b=b;
		}
	}
	




//	for(int i=2;i<=100000;i++) {
		
	
}