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

bool check(const vector<int> &v){
	int diff = v[1] - v[0];
	for(int i = 2 ; i < v.size() ; i++ ){
		if( v[i] - v[i-1] != diff ) return false;
	}
	return true;
}

int main(){
	int n;
	while( cin >> n , n ){
		vector<int> v(n+1);
		for(int i = 0 ; i < n + 1 ; i++ ){
			cin >> v[i];
		}
		int ans;
		for(int i = 0 ; i < n + 1 ; i++ ){
			vector<int> vv;
			for(int j=0 ; j < n + 1 ; j++ ){
				if( i == j ) continue;
				vv.push_back( v[j] );
			}
			if( check(vv) ){
				ans = v[i];
				break;
			}
		}
		cout << ans << endl;
	}
}