import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines D = int(readline()) C = ''.join(read().decode().split()) C = 'x' * 15 + C + 'x' * 15 answer = 0 for n in range(1,len(C)): for i in range(len(C)): if i + n > len(C): break x = C[i:i+n].count('x') if x > D: continue comp = ('o' + C[i:i+n]).count('ox') if comp > 1: continue answer = n print(answer)