d = int(input()) s = input() + input() r = p = 0 for i in range(len(s)): if s[i] == 'x': p = 0 v = p w = d for j in range(i, len(s)): if s[j] == 'x': if w == 0: break w -= 1 elif w != d: w = 0 v += 1 r = max(r, v) if s[i] == 'o': p += 1 print(r)