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

bool ok(vector<int> x){
	int dif = x[1] - x[0];
	for(int i = 0;i < x.size();i++){
		x[i] -= dif*i;
	}
	for(int i = 0;i < x.size();i++){
		if(x[i] != x[0])return false;
	}
	return true;
}

int a[10800];
int main(){
	int n;
	while(cin >> n, n){
		n++;
		for(int i = 0;i < n;i++)cin >> a[i];
		for(int i = 0;i < n;i++){
			vector<int> res;
			for(int j = 0;j < n;j++){
				if(i == j)continue;
				res.push_back(a[j]);
			}
			if(ok(res)){
				cout << a[i] << endl;
				break;
			}
		}
	}
	return 0;
}