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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	
	int n;
	while(cin >> n && n != 0){
		vector<int> h(n + 1);
		for(int i = 0; i < n + 1; ++i){
			cin >> h[i];
		}
		for(int i = 0; i < n + 1; ++i){
			vector<int> vec = h;
			vec.erase(vec.begin() + i);
			int d = vec[1] - vec[0];
			bool check = true;
			for(size_t j = 1; j < vec.size(); ++j){
				if(vec[j] - vec[j - 1] != d){
					check = false;
					break;
				}
			}
			if(check){
				cout << h[i] << endl;
				break;
			}
		}
	}

	return 0;
}