#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1024;
int a[MAXN];
int m, n;
bool dp[MAXN];
bool ok(const int x) {
  int i, j, k;
  memset(dp, false, sizeof(dp));
  dp[0] = (a[0] >= x);
  for (i = 0; i < n; ++i) {
    if (dp[i]) {
      j = i + 1;
      if (j < n && a[j] >= x) dp[j] = true;
      j = i + 2;
      if (j < n && a[j] >= x) dp[j] = true;
    }
  }
  return dp[n - 1];
}
int main() {
  int i, j, k;
  int left(0), right(0), mid, res(0);
  scanf("%d", &n);
  for (i = 0; i < n; ++i) scanf("%d", a + i), right = max(right, a[i]);
  while (left <= right) {
    mid = (left + right) >> 1;
    if (ok(mid))
      left = mid + 1, res = mid;
    else
      right = mid - 1;
  }
  printf("%d\n", res);
  return 0;
}
