D = int(input()) C = input() C = C + input() N = [0] for i, c in enumerate(C, start=1): if c == "x": N.append(i) N += list(range(15,30)) ans = 0 for i in range(len(N) - D - 1): ans = max(ans, N[i + D + 1] - N[i] - 1) print(ans)