#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<int> vi;
const double EPS = 1e-5;

typedef double Number;
typedef vector<Number> Array;
typedef vector<Array> Matrix;

void pMat(Matrix &a){
	REP(i,a.size()){
		REP(j,a[0].size()) cout << a[i][j] << ":";
		cout << endl;
	}
	cout << endl << endl;
}

Matrix mul (Matrix A, Matrix B) {
    int M = A.size(), N = B[0].size();
    assert(A[0].size() == B.size());
    int K = A[0].size();
    Matrix C(M, Array(N, 0));
    for (int i = 0; i < M; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < K; k++) {
                C[i][j] += A[i][k] * B[k][j];
            }
        }
    }
    return C;
}

struct LUinfo {
  vector<Number> value;
  vector<int> index;
};
LUinfo LU_decomposition(Matrix A) {
  const int N = A.size();
  LUinfo data;
  for (int i = 0; i < N; ++i) {
    int pivot = i;
    for (int j = i+1; j < N; ++j)
      if (abs(A[j][i]) > abs(A[pivot][i])) pivot = j;
    swap(A[pivot], A[i]);
    data.index.push_back(pivot);
    for(int j = i+1; j < N; ++j) {
      A[j][i] /= A[i][i];
      for(int k = i+1; k < N; ++k)
        A[j][k] -= A[i][k] * A[j][i];
      data.value.push_back(A[j][i]);
    }
  }
  for(int i = N-1; i >= 0; --i) {
    for(int j = i+1; j < N; ++j)
      data.value.push_back(A[i][j]);
    data.value.push_back(A[i][i]);
  }
  return data;
}
Matrix LU_backsubstitution(const LUinfo &data, Matrix b) {
  const int N = b.size();
  int k = 0;
  for (int i = 0; i < N; ++i){
    swap(b[data.index[i]][0], b[i][0]);
    for(int j = i+1; j < N; ++j)
      b[j][0] -= b[i][0] * data.value[k++];
  }
  for (int i = N-1; i >= 0; --i) {
    for (int j = i+1; j < N; ++j)
      b[i][0] -= b[j][0] * data.value[k++];
    b[i][0] /= data.value[k++];
  }
  return b;
}


int d;

int calc(){
	vector<double> v(d+3);
	int ds = d+1;
	REP(i, d+3) cin >> v[i];
	REP(i, d+3){
		for(int j = i + 1; j < d+3; j++){

			Matrix A(ds, Array(ds, 0));
			Matrix B(ds, Array(1, 0));
			int id = 0;
			REP(k, d+3){
				if(k == i || k == j) continue;
				REP(l, ds) A[id][l] = pow(k, ds-l-1);
				B[id][0] = v[k];
				id++;
			}
			Matrix y = LU_backsubstitution(LU_decomposition(A), B);
			Matrix C(2, Array(ds, 0));
			REP(l, ds) C[0][l] = pow(i, ds-l-1);
			REP(l, ds) C[1][l] = pow(j, ds-l-1);
			
			Matrix z = mul(C, y);
/*
cout << "i : " << i << "j : " << j << endl;
cout << "C : " << endl;
pMat(C);
cout << "z : " << endl;
pMat(z);
*/
			if((abs(z[0][0] - v[i]) < EPS) && (abs(z[1][0] - v[j]) > EPS)) return j;
			if((abs(z[0][0] - v[i]) > EPS) && (abs(z[1][0] - v[j]) < EPS)) return i;
		}
	}
	return -1;
}

int main(void){
	while(cin>>d, d){
		cout << calc() << endl;
	}
	return 0;
}

Measured memory_bytes: 1328