#include <bits/stdc++.h>
using namespace std;
double n, y[1000000], a, b, fix[1000000];
int go(int x, int x1) {
  for (int i = 0; i < n; i++) fix[i] = 0;
  int i1 = -1, i2 = -1;
  double t;
  double a = t = (y[x1] - y[x]) / (x1 - x);
  double b = y[x] - double(a * (x + 1));
  for (int i = 0; i < n; i++)
    if ((i + 1) * a + b == y[i]) fix[i] = 1;
  for (int i = 0; i < n; i++) {
    if (fix[i] == 0 && i1 >= 0) {
      i2 = i;
      break;
    }
    if (fix[i] == 0 && i1 == -1) i1 = i;
  }
  if (i1 == -1 && i2 == -1) return 0;
  if (i2 == -1) return 1;
  a = (y[i2] - y[i1]) / (i2 - i1);
  b = y[i1] - double(a * (i1 + 1));
  for (int i = 0; i < n; i++)
    if ((i + 1) * a + b == y[i]) fix[i] = 1;
  for (int i = 0; i < n; i++)
    if (fix[i] == 0) {
      return 0;
    }
  if (a == t) {
    return 1;
  }
  return 0;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> y[i];
  for (int i = 1; i < n; i++)
    if (go(0, i) == 1) {
      cout << "YES" << endl;
      return 0;
    }
  if (go(2, 3) == 1) {
    cout << "YES" << endl;
    return 0;
  }
  cout << "NO" << endl;
}
