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()) answer = 0 for n in range(1,15): for i in range(14): if i + n > 14: 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)