#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
double s[100005];
double t[100005];
int pos;
int dmp(double k) {
  if (fabs(k) < EPS) return 0;
  return k < 0 ? -1 : 1;
}
int check(double num[], int n) {
  int i;
  if (n == 1) return 1;
  if (n == 2 && num[0] != 0) return 1;
  if (num[0] == 0) {
    for (int i = 0; i < n; i++)
      if (num[i] != 0) {
        pos = i;
        return 0;
      }
    return 1;
  }
  double b = num[1] / num[0];
  double temp = num[1];
  for (i = 2; i < n; i++) {
    temp *= b;
    if (dmp(temp - num[i]) != 0) {
      pos = i;
      return 0;
    }
  }
  return 1;
}
bool gao(int n) {
  int i, len;
  if (n == 2) return 1;
  for (i = 0; i < pos; i++) t[len++] = s[i];
  for (i = pos + 1; i < n; i++) t[len++] = s[i];
  if (check(t, n - 1)) return 1;
  for (i = 1; i < n; i++) t[i - 1] = s[i];
  if (check(t, n - 1)) return 1;
  t[0] = s[0];
  for (i = 2; i < n; i++) t[i - 1] = s[i];
  if (check(t, n - 1)) return 1;
  return 0;
}
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < n; i++) scanf("%lf", &s[i]);
    if (check(s, n)) {
      puts("0");
      continue;
    }
    if (gao(n))
      puts("1");
    else
      puts("2");
  }
  return 0;
}
