#include<bits/stdc++.h>
using namespace std;


const int maxn=1e3+5;
int solve[2][maxn];
int n;

int main()
{
    while( ~scanf("%d",&n) )
    {
        int loop=n;
        while( loop-- )
        {
            scanf("%d",&solve[0][loop]);
        }
        loop=n;
        while( loop-- )
        {
            scanf("%d",&solve[1][loop]);
        }

        loop=n;
        int ret=0x3f3f3f;
        for(int i=0; i<loop; ++i)
        {
            ret=min( ret, solve[0][i]+solve[1][i]-2 );
        }

        printf("%d\n", ret );
    }

    return 0;
}