import sys

n = int(input())
nums = [sys.stdin.readline().strip() for _ in range(n)]
#print(nums)

length = len(nums[0])
count = length - 1

    
while count > -1:
    new_arr = []
    for num in nums:
        new_arr.append(num[count:])
    if len(new_arr) != len(set(new_arr)):
        count -= 1
    elif len(new_arr) == len(set(new_arr)) and count != length:
        print(length-count)
        break
    elif len(new_arr) == len(set(new_arr)) and count == length:
        print(length)
        break

#print(new_arr)
ad91df821334c9571d338797aa27ecbfa8f1baf1
<mask token>

<mask token>
while count > -1:
    new_arr = []
    for num in nums:
        new_arr.append(num[count:])
    if len(new_arr) != len(set(new_arr)):
        count -= 1
    elif len(new_arr) == len(set(new_arr)) and count != length:
        print(length - count)
        break
    elif len(new_arr) == len(set(new_arr)) and count == length:
        print(length)
        break

<mask token>
n = int(input())
nums = [sys.stdin.readline().strip() for _ in range(n)]
length = len(nums[0])
count = length - 1
while count > -1:
    new_arr = []
    for num in nums:
        new_arr.append(num[count:])
    if len(new_arr) != len(set(new_arr)):
        count -= 1
    elif len(new_arr) == len(set(new_arr)) and count != length:
        print(length - count)
        break
    elif len(new_arr) == len(set(new_arr)) and count == length:
        print(length)
        break

import sys
n = int(input())
nums = [sys.stdin.readline().strip() for _ in range(n)]
length = len(nums[0])
count = length - 1
while count > -1:
    new_arr = []
    for num in nums:
        new_arr.append(num[count:])
    if len(new_arr) != len(set(new_arr)):
        count -= 1
    elif len(new_arr) == len(set(new_arr)) and count != length:
        print(length - count)
        break
    elif len(new_arr) == len(set(new_arr)) and count == length:
        print(length)
        break

import sys

n = int(input())
nums = [sys.stdin.readline().strip() for _ in range(n)]
#print(nums)

length = len(nums[0])
count = length - 1

    
while count > -1:
    new_arr = []
    for num in nums:
        new_arr.append(num[count:])
    if len(new_arr) != len(set(new_arr)):
        count -= 1
    elif len(new_arr) == len(set(new_arr)) and count != length:
        print(length-count)
        break
    elif len(new_arr) == len(set(new_arr)) and count == length:
        print(length)
        break

#print(new_arr)