Harry is playing a game with is friend. He is given a notebook which has names of their friends written in various lowercase letter from 'a' to 'z'. His task is to find a 'special-letters'. A letter is a 'special-letters' if it occurs at least once in each of their friends name.

Given the list of N names, display the number of special-letters that exist in names.

Input 
The first line consists of N, the number of names.
Each of the next N lines contain names. Each name consists of lowercase letters of English alphabet.

Output 
Print the number of special-letter that are common in these names. If there are none, print 0.

Constraints 
1 ≤ N ≤100 
Each name consists of only lowercase letters ('a'-'z').  
1 ≤ Length of each name ≤ 100     

SAMPLE INPUT
3
abcdde
baccd
eeabcg

SAMPLE OUTPUT
3

Explanation

Only "a", "b", "c" are the 3 kind of special-letters, since these are the only characters that occur in each of the name has.
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
n=int(raw_input())
list=[]
s=raw_input()
for i in s:
	if i not in list:
		list.append(i)
for i in range(n-1):
	s=raw_input()
	for j in list:
		if j not in s:
			list.remove(j)
print len(list)