#include <bits/stdc++.h>
using namespace std;
int n, i, j, a[111111], m = 2, t;
int main() {
  cin >> n;
  a[n] = 111111111;
  if (n == 1) {
    cout << "0\n";
    return 0;
  }
  for (i = 0; i < n; i++) cin >> a[i];
  if (n == 2) {
    if (!a[0] && a[1])
      cout << "1\n";
    else
      cout << "0\n";
    return 0;
  }
  for (i = 1; i < n; i++) t = t + (bool)a[i];
  if (t < 2) {
    cout << t << endl;
    return 0;
  }
  for (i = 0; i < 2; i++)
    for (j = i + 1; j < i + 3; j++) {
      long double p = 1. * a[j] / a[i], x = a[j];
      if (a[i] == 0) p = 0;
      int k = j - 1;
      for (int u = j; u < n; u++) {
        if (fabs(x - a[u]) > 1e-4) {
          k++;
          if (k == 2) break;
        } else
          x *= p;
      }
      m = min(m, k);
    }
  cout << m << endl;
  return 0;
}
