#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int d;
double v[10];
double rec(vector<pair<double,double> >vec,double x){
	double ret = 0;
	for(int i=0;i<vec.size();i++){
		double add = vec[i].sc;
		for(int j=0;j<vec.size();j++){
			if(i == j) continue;
			add *= (x-vec[j].fi);
			add /= (vec[i].fi-vec[j].fi);
		}
		ret += add;
	}
	return ret;
}
int main(){
	while(1){
		cin>>d;
		if(d==0) return 0;
		for(int i=0;i<=d+2;i++) cin>>v[i];
		for(int i=0;i<=d+2;i++){
			for(int j=0;j<=d+2;j++){
				if(i == j) continue;
				vector<pair<double,double> >vec;
				for(int k=0;k<=d+2;k++) {
					if(i == k || j == k) continue;
					vec.pb(mp((double)(k),v[k]));
				}
				double act = rec(vec,(double)(j));
				if(abs(act-v[j]) >1e-1) goto fail;
			}
			cout<<i<<endl; break;
			fail:;
		}
	}
}
