#include <iostream>
#include <vector>
using namespace std;

bool check(vector<int> v,int n){
	for (int i = 1; i < n; i++){
		if (v[i] - v[i - 1] != v[i + 1] - v[i]){
			return false;
		}
	}
	return true;
}

int main(){
	int N;
	while (cin >> N){
		if (N == 0){
			break;
		}
		vector<int> h;
		for (int i = 0; i < N + 1; i++){
			int x;
			cin >> x;
			h.push_back(x);
		}
		for (int i = 0; i < N + 1; i++){
			vector<int> t = h;
			t.erase(t.begin() + i);
			if (check(t, N - 1)){
				cout << h[i] << endl;
				break;
			}
		}
		
	}
}
