#include <bits/stdc++.h>
using namespace std;
vector<int> pre;
bool visit[1005];
double val[1005];
double cal(int u, int v) { return (val[v] - val[u]) / (v - u); }
bool check() {
  int sz = pre.size();
  if (sz <= 2) return true;
  double dis = cal(pre[0], pre[1]);
  int id = pre[1];
  for (int i = 2; i < sz; i++)
    if (cal(pre[i - 1], pre[i]) != dis) return false;
  return true;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> val[i];
  bool OK = false;
  for (int i = 2; i <= n;) {
    if (!check()) break;
    for (int j = 1; j <= n; j++)
      if (j <= i)
        visit[j] = true;
      else
        visit[j] = false;
    double dis = cal(1, i);
    int id = i, last = n + 1;
    int fir = -1, sec = -1;
    bool flag = true;
    for (int j = i + 1; j <= n; j++) {
      if (cal(id, j) == dis) {
        visit[j] = true;
        id = j;
      } else {
        if (fir == -1)
          fir = j;
        else if (sec == -1)
          sec = j;
        if (flag) last = j;
        flag = false;
      }
    }
    int sz = pre.size();
    if (!sz) {
      if (fir == -1) {
        for (int j = i; j < last; j++) pre.push_back(j);
        i = last;
        continue;
      } else if (sec == -1 && cal(1, fir) != cal(1, i)) {
        OK = true;
        break;
      }
      dis = cal(fir, sec);
      id = sec;
    } else if (sz == 1) {
      if (fir == -1 && cal(1, pre[0]) != cal(1, i)) {
        OK = true;
        break;
      }
      dis = cal(pre[0], fir);
      id = fir;
    } else
      dis = cal(pre[0], pre[1]), id = pre[sz - 1];
    flag = true;
    for (int j = id + 1; j <= n; j++) {
      if (cal(id, j) == dis) {
        if (visit[j]) {
          flag = false;
          break;
        }
      } else {
        if (!visit[j]) {
          flag = false;
          break;
        }
      }
    }
    if (flag && dis == cal(1, i)) {
      OK = true;
      break;
    }
    for (int j = i; j < last; j++) pre.push_back(j);
    i = last;
  }
  if (!OK) {
    double dis = cal(2, 3);
    bool flag = true;
    for (int i = 4; i <= n; i++)
      if (dis != cal(i - 1, i)) {
        flag = false;
        break;
      }
    if (flag && dis != cal(1, 2)) OK = true;
  }
  if (OK)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
