#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  long long int arr[1002] = {0}, x1 = 1, y1, x2 = 2, y2, x3 = 3, y3, x = 0,
                y = 0;
  int visited[1002] = {0}, f = 0;
  long double dd, m12, m13, m23, theta1 = 0, theta2 = 0;
  vector<int> line2nd;
  unordered_map<long double, int> mp;
  unordered_map<long double, int>::iterator it;
  arr[0] = 0;
  visited[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
    visited[i] = 0;
  }
  y1 = arr[1];
  y2 = arr[2];
  y3 = arr[3];
  m12 = (y1 - y2) * 1.000 / (x1 - x2);
  m13 = (y1 - y3) * 1.000 / (x1 - x3);
  m23 = (y2 - y3) * 1.000 / (x2 - x3);
  mp[m12]++;
  mp[m13]++;
  mp[m23]++;
  for (int i = 4; i <= n; i++) {
    dd = (y1 - arr[i]) / (1.0000 * (x1 - i));
    mp[dd]++;
    dd = (y2 - arr[i]) / (1.0000 * (x2 - i));
    mp[dd]++;
    dd = (y3 - arr[i]) / (1.0000 * (x3 - i));
    mp[dd]++;
  }
  if (mp.size() == 1) {
    f = 1;
  } else {
    if (mp[m12] > mp[m13] && mp[m12] > mp[m23]) {
      theta1 = m12;
      x = x1;
      y = y1;
    } else if (mp[m13] > mp[m23]) {
      theta1 = m13;
      x = x1;
      y = y1;
    } else {
      theta1 = m23;
      x = x2;
      y = y2;
    }
    visited[x]++;
    for (int i = 1; i <= n; i++) {
      if (i != x) {
        dd = (y - arr[i]) / (1.0000 * (x - i));
        if (dd != theta1) {
          line2nd.push_back(i);
        } else {
          visited[i]++;
        }
      }
    }
    if (line2nd.size() > 1) {
      int tempx = line2nd[0], tempx2 = line2nd[1];
      theta2 = (arr[tempx2] - arr[tempx]) * 1.0000 / (tempx2 - tempx);
      for (int i = 1; i <= n; i++) {
        if (i != tempx) {
          dd = (arr[tempx] - arr[i]) * 1.0000 / (tempx - i);
          if (visited[i] == 0) {
            if (dd != theta2) {
              f = 1;
              break;
            }
          }
        }
      }
      if (theta2 != theta1) f = 1;
    }
  }
  if (f == 1)
    cout << "NO";
  else {
    cout << "YES";
  }
  return 0;
}
