#include <bits/stdc++.h>
using namespace std;

bool solve(vector<int> v, int idx){
  v.erase(v.begin() + idx);
  int diff = v[1] - v[0];
  for(int i = 0 ; i < (int)v.size()-1 ; i++){
    if(diff != v[i+1] - v[i]) 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];
    
    for(int i = 0 ; i < n+1 ; i++){
      bool ret = solve(v, i);
      if(ret){
	cout << v[i] << endl;
	break;
      }
    }    
  }
  return 0;
}