#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;

typedef pair<double,double> pdd;
#define x first
#define y second

double lagrange(double x, int deg, vector<pdd> pt, int skip) {
	double y = 0;
	for(int i = 0; i < deg+2; i++) {
		if(i == skip) continue;
		double t = 1;
		for(int j = 0; j < deg+2; j++) {
			if(j == i || j == skip) continue;
			t *= (x - pt[j].x) / (pt[i].x - pt[j].x);
		}
		t *= pt[i].y;
		y += t;
	}
	return y;
}

int main() {
	int d;
	while(cin >> d, d) {
		vector<pdd> pt(d+3);
		for(int i = 0; i < d+3; i++) {
			cin >> pt[i].y;
			pt[i].x = i;
		}

		int res = d+2;
		for(int i = 0; i < d+2; i++) {
			double y;
			y = lagrange(d+2, d, pt, i);
			if(fabs(y - pt.back().y) < 0.5) {
				res = i;
				break;
			}
		}
		cout << res << endl;
	}
}