#include <bits/stdc++.h>   using namespace std;   const int MAXN = 100000 + 5;   const double EPS = 1e-3;   int n;   int t[MAXN];   int g(double q) {     bool ok = true;     for (int i = 1; i < n; i++)       if (fabs(double(t[i] - t[i - 1] * q)) > EPS) ok = false;     if (ok) return 0;     ok = true;     for (int i = 2; i < n; i++)       if (fabs(double(t[i] - t[i - 1] * q)) > EPS) ok = false;     if (ok) return 1;     ok = true;     int prev = t[0];     for (int i = 1; i < n; i++)       if (fabs(double(t[i] - prev * q)) > EPS) {         if (!ok) return 2;         ok = false;       } else         prev = t[i];     return 1;   }   int f() {     if (n == 1) return 0;     double q1 = 0, q2 = 0;     if (t[0] != 0) q1 = double(t[1]) / t[0];     if (t[n - 2] != 0) q2 = double(t[n - 1]) / t[n - 2];     return min(g(q1), g(q2));   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &t[i]);     printf( %d n , f());   }   