CodeswarBala found various ornaments in Btyeland. Each ornament is made up of  various items, and each item is represented by a letter from 'a' to 'z'. An item can be present multiple times in a ornament . An item is called special item  if it occurs at least once in each of the ornament.

Given the list of N ornaments with their compositions, display the number of special items that exist in those ornaments.

Input Format

The first line consists of an integer, N, the number of ornaments. 
Each of the next NNlines contains a ornaments'composition. Each composition consists of lower-case letters  as mentioned above.

Constraints 
1≤N≤100
1≤ length of each composition ≤100

Output Format

Print the number of special items that are common in these ornaments. If there are none, print 0.

SAMPLE INPUT
3
abcdde
baccd
eeabg

SAMPLE OUTPUT
2

Explanation

Only "a" and "b" are the two kinds of special elements, since these are the only characters that occur in every ornaments's composition.
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def zerolistmaker(n):
    listofzeros = [0] * n
    return listofzeros
n=input()
l=zerolistmaker(101)
m=n
while n:
	
	x=raw_input()
	a=set(x)
	
	for i in a:
		l[ord(str(i))-96]+=1
		
		
	n=n-1
g=0
for k in l:
	if k==m:
		g=g+1
		
if g>0:
	print g
else:
	print "0"