#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, a[N], b[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  if (n == 1) {
    cout << 0;
    return 0;
  }
  if (n == 2) {
    if (a[1] == 0 && a[2] != 0) {
      cout << 1;
      return 0;
    } else {
      cout << 0;
      return 0;
    }
  }
  int wrong = 0;
  for (int i = 3; i <= n; i++) {
    if (a[1] * a[i] != a[2] * a[i - 1]) {
      wrong++;
      if (i < n) {
        if (a[i + 1] * a[1] != a[i - 1] * a[2])
          wrong++;
        else
          i++;
      }
    }
    if (a[1] == 0 && a[i] != 0) wrong++;
  }
  if (wrong < 2) {
    cout << wrong;
    return 0;
  } else {
    wrong = 0;
    for (int i = 4; i <= n; i++) {
      if (a[2] * a[i] != a[3] * a[i - 1]) {
        wrong++;
        if (i < n) {
          if (a[i + 1] * a[2] != a[i - 1] * a[3])
            wrong++;
          else
            i++;
        }
      }
      if (a[2] == 0 && a[i] != 0) wrong++;
    }
    if (wrong == 0) {
      cout << 1;
      return 0;
    } else {
      wrong = 0;
      a[2] = a[1];
      for (int i = 4; i <= n; i++) {
        if (a[2] * a[i] != a[3] * a[i - 1]) {
          wrong++;
          if (i < n) {
            if (a[i + 1] * a[2] != a[i - 1] * a[3])
              wrong++;
            else
              i++;
          }
        }
        if (a[2] == 0 && a[i] != 0) wrong++;
      }
      if (wrong == 0) {
        cout << 1;
        return 0;
      } else {
        cout << 2;
        return 0;
      }
    }
  }
}
