D = int(input()) # xが平日, oが休日 s = str(input()) s += str(input()) ans = 0 # xをoにしたら飛ばすようにする for i in range(len(s)): cnt = i tmp = 0 hoge = D while len(s) > cnt: if s[cnt] == "x": if hoge <= 0: break else: for _ in range(hoge): if s[cnt] == "o": break cnt += 1 tmp += 1 hoge = 0 elif s[cnt] == "o": tmp += 1 cnt += 1 ans = max(ans, tmp) print(ans)