#include <bits/stdc++.h>
using namespace std;
int n, a[100001];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  if (n == 1) return puts("0");
  if (n == 2 && !a[0] && a[1]) return puts("1");
  if (n == 2) return puts("0");
  int ans = 2;
  for (int i = 0; i < 3; i++)
    for (int j = i + 1; j < 3; j++) {
      if (!a[i] && a[j]) continue;
      double r = a[i] ? 1. * a[j] / a[i] : 0;
      int cnt = (i + j >= 2), last = j;
      for (int k = j + 1; k < n; k++)
        if (abs(a[last] * r - a[k]) < 1e-9)
          last = k;
        else
          cnt++;
      ans = min(ans, cnt);
    }
  printf("%d\n", ans);
}
