#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

typedef vector<double> vdbl;

void jordan(vector<vdbl> &a){
	int n = a.size();
	for(int i = 0; i < n; ++i){
		int idx = i;
		double piv = abs(a[i][i]);
		for(int j = i + 1; j < n; ++j){
			double p = abs(a[j][i]);
			if(piv < p){
				piv = p;
				idx = j;
			}
		}

		a[i].swap(a[idx]);
		piv = a[i][i];
		for(int j = 0; j <= n; ++j){
			a[i][j] /= piv;
		}

		for(int k = 0; k < n; ++k){
			double d = a[k][i];
			for(int j = 0; j <= n; ++j){
				if(k != i){
					a[k][j] -= d * a[i][j];
				}
			}
		}
	}
}

double check(const vdbl &x, const vdbl &y){
	int n = x.size();
	int d = n - 2;
	vector<vdbl> a(d + 1, vdbl(d + 2));
	for(int i = 0; i <= d; ++i){
		for(int j = 0; j <= d; ++j){
			for(int k = 0; k < n; ++k){
				a[j][i] += pow(x[k], i + j);
			}
		}
	}
	
	for(int j = 0; j <= d; ++j){
		for(int k = 0; k < n; ++k){
			a[j][d + 1] += y[k] * pow(x[k], j);
		}
	}

	jordan(a);

	double eps = -1.0;
	for(int i = 0; i < n; ++i){
		double s = 0.0, t = 1.0;
		for(int j = 0; j <= d; ++j){
			s += a[j][d + 1] * t;
			t *= x[i];
		}
		eps = max(eps, abs(y[i] - s));
	}
	return eps;
}

int solve(const vdbl &v){
	vdbl x(v.size() - 1), y = x;

	double mineps = 1e99;
	int ans = -1;
	for(int i = 0; i < v.size(); ++i){
		int t = 0;
		for(int j = 0; j < v.size(); ++j){
			if(j != i){
				x[t] = (double)j;
				y[t] = v[j];
				++t;
			}
		}

		double eps = check(x, y);
		if(mineps > eps){
			mineps = eps;
			ans = i;
		}
	}
	return ans;
}

int main(){
	int d;
	while(scanf("%d", &d), d){
		vdbl v(d + 3);
		for(int i = 0; i < d + 3; ++i){
			scanf("%lf", &v[i]);
		}

		printf("%d\n", solve(v));
	}
}