D = int(input()) C = ['x'] C.extend([c for c in input()]) C.extend([c for c in input()]) C.extend(['x'] * (D + 1)) max_holiday = D for i in range(1, 16): cnt = 0 j = 1 while C[i - j] == 'o': cnt += 1 j -= 1 cnt += D j = D while C[i + j] == 'o': cnt += 1 j += 1 # if max_holiday < cnt: # print(i, cnt) max_holiday = max(max_holiday, cnt) print(max_holiday) # print(C)