#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn = 100010;
int A[maxn],B[maxn],C[maxn];
int main()
{
int n,i,total;
while(scanf("%d",&n)!=EOF)
{
for(i = 0; i < n; ++i)
{
scanf("%d",A+i);
}
for(i = 0; i < n; ++i)
{
scanf("%d",B+i);
}
//已知A,B已经排好序
total = 1;
int uplimit = n + 2,cnt = 0;
int peek1 = 0, peek2 = 0,medium = 0;
while(total < uplimit && peek1 < n && peek2 < n) //因为一共只选n个数,所以peek1和peek2都不会出现数组下标越界的情况
{
if(A[peek1] < B[peek2])
{
C[total++] = A[peek1++];
}
else
{
C[total++] = B[peek2++];
}
// ++total;
}
if(total < uplimit)
{
if(peek1 < n)
{
while(total < uplimit)
{
C[total++] = A[peek1++];
}
}
else if(peek2 < n)
{
while(total < uplimit)
{
C[total++] = B[peek2++];
}
}
}
medium= C[n] + C[n+1];
printf("%d\n",medium>>1);
}
return 0;
}
//思路不难想到,类似于一个归并排序,不过很容易忘了处理下标的越界情况,
即当peek值>=n时,A,B数组的值没有什么意义