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.append(15) ans = 0 if len(N) - 2 - D <= 0: print(14) exit() for i in range(len(N) - D - 1): ans = max(ans, N[i + D + 1] - N[i] - 1) print(ans)