#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<numeric>
#include<set>

using namespace std;

typedef long long ll;

int main()
{
	int N;
	while (cin >> N, N) {
		vector<ll> v(N + 1);
		for (int i = 0; i < N + 1; i++) {
			cin >> v[i];
		}

		bool flag = 0;
		for (int i = 0; i < N + 1; i++){
			ll d = 100000000000,pre_d = 100000000000;
			flag = 0;
			for (int j = N; j >= 1; j--){
				if (j == i)continue;
					if (j - 1 == i) {
						if (j - 2 >= 0) {
							d = v[j] - v[j - 2];
						}
						/*
						else {
							d = v[j];
						}
						*/
					}
					else {
						d = v[j] - v[j - 1];
					}

					if (d != 100000000000 && pre_d != 100000000000) {
						if (pre_d != d) {
							flag = 1;
							break;
						}
				    }
					pre_d= d;
			}
			if (!flag) {
				cout << v[i] <<  endl;
				break;
			}
		}		
	}
	return 0;
}