#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the gemstones function below.
def gemstones(arr):
    s=""
    count=[]
   
    for i in arr:
        s+=i
    sett = set(s)
    for i in sett:
        countt=0
        for j in arr:
            if i in j:
                print(i,j)
                countt+=1
        print(countt)
        if countt==len(arr):
            count.append(i)
    print(sett)
    print(count)
    return len(count)
                

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    n = int(input())

    arr = []

    for _ in range(n):
        arr_item = input()
        arr.append(arr_item)

    result = gemstones(arr)

    fptr.write(str(result) + '\n')

    fptr.close()
