#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) {
  if (a < b)
    return (a);
  else
    return (b);
}
int main() {
  int n, arr[1005], flag = 0, a, b, i, j, c, d;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> arr[i];
  if (n == 1 || n == 2 || n == 3)
    flag = 1;
  else {
    for (i = 3; i <= n - 1; i++) {
      flag = 0;
      c = min(arr[i], arr[i + 1]);
      if (c == arr[i])
        d = arr[i + 1];
      else
        d = arr[i];
      for (j = 1; j + 2 <= i; j++) {
        a = min(arr[j], arr[j + 1]);
        if (a == arr[j])
          b = arr[j + 1];
        else
          b = arr[j];
        if (arr[i] < a && arr[i + 1] < a)
          flag = 1;
        else if (arr[i] > b && arr[i + 1] > b)
          flag = 1;
        else if (a <= arr[i] && b >= arr[i] && a <= arr[i + 1] &&
                 b >= arr[i + 1])
          flag = 1;
        else if (c <= a && d >= b)
          flag = 1;
        else {
          flag = 0;
          break;
        }
      }
      if (flag == 0) break;
    }
  }
  if (flag == 0)
    cout << "yes";
  else
    cout << "no";
  return 0;
}
