#include<iostream>
using namespace std;

int n;
int weeds[101];
int d;
int main()
{
  while(true)
  {
    cin >> n;
    if(!n)
      break;
    for(int i = 0; i < n + 1; i++)
    {

      cin >> weeds[i];
    }
    for(int i = 0; i < n + 1; i++)
    {
      d = weeds[1] - weeds[0];
      if(i < 2)
        d = weeds[3] - weeds[2];

      for(int j = 1; j < n + 1; j++)
      {
        if(j == i)
          continue;
        if(j - 1 == i)
        {
          if(j < 2)
            continue;
          if(weeds[j] - weeds[j - 2] != d)
            goto end;
        }
        else if(weeds[j] - weeds[j - 1] != d)
        {
          goto end;
        }
      }
      cout << weeds[i] << endl;
      break;
    end:;
    }
  }
}