#include<iostream>
#include<vector>
using namespace std;
int n, a[1000], s; vector<int>p;
int main() {
	while (true) {
		cin >> n;
		if (!n) { break; }
		for (int i = 0; i < n + 1; i++) {
			cin >> a[i];
		}
		for (int i = 0; i < n + 1; i++) {
			p.clear();
			for (int j = 0; j < n + 1; j++) {
				if (i != j) {
					p.push_back(a[j]);
				}
			}
			for (int j = 0; j < p.size() - 1; j++) {
				if (j == 0) { 
					s = p[j + 1] - p[j];
				}
				else if (p[j + 1] - p[j] != s) {
					goto E;
				}
			}
			cout << a[i] << endl;
			goto otawa;
		E:;
		}
	otawa:;
	}
}