```python
def max_sum_rectangular_grid(grid, n):
    if n == 0:
        return 0

    # Initialize DP variables for the first column (i=0)
    # prev_top: max sum up to the previous column, including its top element
    # prev_bottom: max sum up to the previous column, including its bottom element
    # prev_none: max sum up to the previous column, excluding its elements
    prev_top = grid[0][0]
    prev_bottom = grid[1][0]
    prev_none = 0

    # Iterate from the second column to the end
    for i in range(1, n):
        # Calculate DP values for the current column (i)
        
        # Max sum if we include the top element of the current column.
        # We cannot have included the top element of the previous column.
        curr_top = grid[0][i] + max(prev_bottom, prev_none)
        
        # Max sum if we include the bottom element of the current column.
        # We cannot have included the bottom element of the previous column.
        curr_bottom = grid[1][i] + max(prev_top, prev_none)
        
        # Max sum if we exclude elements from the current column.
        # We can come from any state of the previous column.
        curr_none = max(prev_top, prev_bottom, prev_none)

        # Update the 'previous' variables for the next iteration
        prev_top = curr_top
        prev_bottom = curr_bottom
        prev_none = curr_none

    # The final result is the maximum of the three possible states for the last column
    return max(prev_top, prev_bottom, prev_none)

```