#include <bits/stdc++.h>
using namespace std;
int cmp(vector<int> x, vector<int> y) { return x[0] < y[0]; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(3));
  multiset<pair<int, int>> stl, str;
  int prev;
  cin >> prev;
  for (int i = 1; i < n; ++i) {
    int cur;
    cin >> cur;
    a[i][0] = abs(cur - prev);
    a[i][1] = min(cur, prev);
    a[i][2] = max(cur, prev);
    stl.insert(make_pair(min(cur, prev), max(cur, prev)));
    str.insert(make_pair(max(cur, prev), min(cur, prev)));
    prev = cur;
  }
  bool ok = true;
  sort(a.begin(), a.end(), cmp);
  for (int i = 1; i < n; ++i) {
    multiset<pair<int, int>>::iterator it;
    it = stl.lower_bound(make_pair(a[i][1] + 1, 0));
    if (a[i][0] > 1) {
      if (it != stl.end()) {
        if (it->first < a[i][2]) {
          ok = false;
          break;
        }
      }
      if (!ok) break;
      it = str.lower_bound(make_pair(a[i][2] + 1, 0));
      if (it != str.end()) {
        if (it->first < a[i][1]) {
          ok = false;
          break;
        }
      }
      if (!ok) break;
    }
    it = stl.find(make_pair(a[i][1], a[i][2]));
    stl.erase(it);
    it = str.find(make_pair(a[i][2], a[i][1]));
    str.erase(it);
  }
  if (ok)
    cout << "no";
  else
    cout << "yes";
  return 0;
}
