#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-5;
/* ---------------------------------------------------------------------------------------------------- */

template <typename T>
struct Matrix {
  vector<vector<T>> val;
  Matrix(int n, int m, T x = 0) : val(n,vector<T>(m,x)) {}
  void init(int n, int m, T x = 0) { val.assign(n,vector<T>(m,x)); }
  size_t size() const { return val.size(); }
  inline vector<T>& operator[](int i) { return val[i]; }
};

template <typename T>
int GaussJordan(Matrix<T> &A, bool is_extended = false) {
  int m = A.size(), n = A[0].size();
  int rank = 0;
  for (int col = 0; col < n; col++) {
    if (is_extended && col == n-1) break;
    int pivot = -1;
    T ma = EPS;
    for (int row = rank; row < m; row++) {
      if (abs(A[row][col]) > ma) {
        ma = abs(A[row][col]);
        pivot = row;
      }
    }
    if (pivot == -1) continue;
    swap(A[pivot], A[rank]);
    T fac = A[rank][col];
    for (int col2 = 0; col2 < n; col2++) A[rank][col2] /= fac;
    for (int row = 0; row < m; row++) {
      if (row != rank && abs(A[row][col]) > EPS) {
        T fac = A[row][col];
        for (int col2 = 0; col2 < n; col2++) {
          A[row][col2] -= A[rank][col2] * fac;
        }
      }
    }
    rank++;
  }
  return rank;
}

template <typename T>
vector<T> linear_equation(Matrix<T> A, vector<T> b) {
  int m = A.size(), n = A[0].size();
  Matrix<T> M(m,n+1);
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) M[i][j] = A[i][j];
    M[i][n] = b[i];
  }
  int rank = GaussJordan(M,true);
  vector<T> res;
  for (int row = rank; row < m; row++) if (abs(M[row][n]) > EPS) return res;
  res.assign(n,0);
  for (int i = 0; i < rank; i++) res[i] = M[i][n];
  return res;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int d;
  while (cin >> d, d) {
    // cout << d << endl;
    vector<double> v(d+3);
    REP(i,d+3) cin >> v[i];
    REP(i,d+3) {
      Matrix<double> A(d+3,d+1);
      vector<double> b(d+3);
      REP(j,d+3) {
        if (j == i) {
          REP(k,d+1) A[j][k] = 0.0;
          b[j] = 0.0;
        } else {
          int mul = 1;
          REP(k,d+1) A[j][k] = mul, mul *= j;
          b[j] = v[j];
        }
      }
      // cout << "i = " << i << endl;
      vector<double> x = linear_equation(A,b);
      // for (int j = 0; j < x.size(); j++) {
      //   cout << x[j] << " \n"[j+1==x.size()];
      // }
      if (!x.empty()) {
        cout << i << endl;
        break;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3176