#include<bits/stdc++.h>

using namespace std;

int getVal(std::vector<int> v, int i) {
	if (i == -1)
		return INT_MIN;
	if (i == v.size())
		return INT_MAX;
	return v[i];
}

int getIndices(int rShort, std::vector<int> aShort, std::vector<int> aLong) {
	int midIndex = (aShort.size() + aLong.size()) / 2;
	int rLong = midIndex - rShort ;
	return rLong;
}


int getDirection(int lShort, int rShort, int lLong, int rLong, vector<int> aShort, vector<int> aLong) {
	if (getVal(aShort, lShort) > getVal(aLong, rLong))
		return -1;

	if (getVal(aLong, lLong) > getVal(aShort, rShort))
		return 1;

	return 0;
}

double getResult(int lShort, int rShort, int lLong, int rLong, vector<int> aShort, vector<int> aLong) {
	int odd;
	odd = (aShort.size() + aLong.size()) % 2;
	if (odd) {
		return min(getVal(aShort, rShort), getVal(aLong, rLong));
	}
	return min(max(getVal(aShort, lShort), getVal(aLong, lLong)) , min(getVal(aShort, rShort), getVal(aLong, rLong)));
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n;
	cin >> n;
	if(n <= 0) return 0;
	vector<int> aShort, aLong;
	for (int i = 0; i < n; i++) {
		int j;
		cin >> j;
		aShort.push_back(j);
	}
	for (int i = 0; i < n; i++) {
		int j;
		cin >> j;
		aLong.push_back(j);
	}

	int lShort = 1, rShort = 1, lLong = 1, rLong = 1, d = 1, l = 0, r = n;
	int m = 0;

	while (d != 0) {
		m = l + (r - l) / 2;
		rShort = m;
		rLong = getIndices(m, aShort, aLong);
		lLong = rLong - 1;
		lShort = rShort - 1;
		d = getDirection(lShort, rShort, lLong, rLong, aShort, aLong);
		if (d < 0)
			r = m - 1;
		if (d > 0)
			l = m + 1;
	}

	int result = getResult(lShort, rShort, lLong, rLong, aShort, aLong);
	cout << result << endl;

	return 0;

}