#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>

#define rep(i, a) REP(i, 0, a)
#define REP(i, a, b) for(int i = a; i < b; ++i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> P;
typedef std::pair<P, int> PP;
struct edge{ int to, time, cost; };
const double esp = 1e-9;
const int infi = (int)1e+9;
const ll infll = (ll)1e+17;

int n;

int main(){
	while (std::cin >> n, n){
		++n;
		std::vector<int> s, s2;
		rep(i, n){
			int h;
			std::cin >> h;
			s.push_back(h);
		}
		rep(i, n){
			s2 = s;
			s2.erase(s2.begin() + i, s2.begin() + i + 1);
			bool f = true;
			int k = s2[1] - s2[0];
			rep(j, n - 2){
				if (s2[j + 1] - s2[j] != k)f = false;
			}
			if (f){
				std::cout << s[i] << std::endl;
				break;
			}
		}
	}
	return 0;
}