#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > inter;
int l, r, n, i, vec[10000000];
bool busca(int x, int a, int b) {
  int j, fi, se;
  for (j = 0; j < inter.size(); j++) {
    fi = inter[j].first, se = inter[j].second;
    if (a <= fi && fi <= b && a <= se && se <= b) {
      if (fi != a || se != b) {
        if (fi < x && x < se) return 0;
      }
    }
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &vec[i]);
  bool sw = 1;
  l = r = vec[0];
  for (i = 1; i < n && sw; i++) {
    if (vec[i - 1] == l || vec[i - 1] == r) {
      if (vec[i] < l || vec[i] > r) {
        if (vec[i] - vec[i - 1] > 0)
          r = vec[i];
        else
          l = vec[i];
      } else {
        if (inter[inter.size() - 1].first < vec[i] &&
            vec[i] < inter[inter.size() - 1].second) {
          if (vec[i] - vec[i - 1] > 0)
            l = vec[i - 1], r = vec[i - 2];
          else
            r = vec[i - 1], l = vec[i - 2];
        }
        sw = busca(vec[i], l, r);
      }
    } else {
      if (vec[i] < l || vec[i] > r)
        sw = 0;
      else {
        if (vec[i] - vec[i - 1] > 0)
          l = vec[i - 1];
        else
          r = vec[i - 1];
        sw = busca(vec[i], l, r);
      }
    }
    inter.push_back({min(vec[i], vec[i - 1]), max(vec[i], vec[i - 1])});
  }
  printf("%s\n", sw ? "no" : "yes");
  return 0;
}
