D = int(input()) line1 = input().strip() line2 = input().strip() mid = line1 + line2 pre = 'x' * (D + 1) post = 'x' * (D + 1) timeline = pre + mid + post def max_consecutive(s): current = 0 max_o = 0 for c in s: if c == 'o': current += 1 if current > max_o: max_o = current else: current = 0 return max_o max_result = 0 for i in range(len(timeline) - D + 1): substring = timeline[i:i+D] if all(c == 'x' for c in substring): new_s = timeline[:i] + 'o' * D + timeline[i+D:] current_max = max_consecutive(new_s) if current_max > max_result: max_result = current_max print(max_result)