import sys input=lambda: sys.stdin.readline().rstrip() d=int(input()) C=input() C+=input() C="x"*d+C+"x"*d def ct(X): ret=0 cur=0 for i in range(len(X)): if X[i]=="o": cur+=1 else: ret=max(ret,cur) cur=0 else: ret=max(ret,cur) print(X) return ret ans=d for i in range(d+14): ans=max(ans,ct(C[:i]+"o"*d+C[i+d:])) print(ans)