d = int(input()) c = ["x"] * d c += list(input()) c += list(input()) c += ["x"] * d l = len(c) cc = [c[:] for j in range(15 + d)] cnt = 0 ans = 0 num = [] for j in range(15 + d): flag = 0 for k in range(j,j + d): if cc[j][k] == "o": flag = 1 break cc[j][k] = "o" if flag == 0: num.append(j) for j in num: for i in range(l): if cc[j][i] == "o": cnt += 1 ans = max(ans, cnt) if cc[j][i] == "x": cnt = 0 print(ans)