n = int(input()) s = input() + input() ans = 0 for i in range(15-n): s2 = (s[:i] + "o"*n + s[i+n:]).split("x") longest = (max([ list(i).count("o") for i in s2 ])) ans = max(longest,ans) print(ans)