#define _CRT_SECURE_NO_WARNINGS
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(c) begin(c), end(c)
#define range(i,a,b) for(int i = a; i < (int)(b); i++)
#define rep(i,b) range(i,0,b)
#define pb push_back
#define eb emplace_back

using ld = double;
const ld EPS = 1e-8;
typedef vector<ld> vec;
typedef vector<vec> mat;

vec GaussJordan(mat A){
    int n = A.size();
    int m = A[0].size();
    for(int i = 0; i < n; i++){
        int pivot = i;
        for(int j = i; j < n; j++) {
            if(abs(A[j][i]) > abs(A[pivot][i])) pivot = j;
        }
        swap(A[i], A[pivot]);
        if(abs(A[i][i]) < EPS) return {};
        for(int j = i + 1; j < m; j++) A[i][j] /= A[i][i];
        for(int j = 0; j < n; j++) {
            if(i != j) {
                for(int k = i + 1; k < m; k++) A[j][k] -= A[j][i] * A[i][k];
            }
        }
    }
    vec x(n);
    for(int i = 0; i < n; i++) x[i] = A[i].back();
    return x;
}

int d;
vec b;

auto y = [](const vec &f, ld x){
    ld res = 0, cur = 1;
    rep(i,d+1){
        res += cur * f[i];
        cur *= x;
    }
    return res;
};

int solve(){
    mat A(d+3, vec(d+2));
    rep(i,d+3){
        ld cur = 1;
        rep(j,d+1){
            A[i][j] = cur;
            cur *= i;
        }
        A[i][d+1] = b[i];
    }
    vector<int> cnt(d+3);
    rep(i,d+3)rep(j,i){
        mat P;
        vector<pair<int,ld>> test;
        rep(k,d+3){
            if(k == i || k == j){
                test.eb(k,b[k]);
            } else {
                P.pb(A[k]);
            }
        }
        vec c = GaussJordan(P);
        rep(k,2){
            int x = test[k].first;
            ld resy = y(c, x);
            ld expy = test[k].second;
            cnt[x] += abs(expy - resy) > 1e-3;
        }
    }
    return max_element(all(cnt)) - cnt.begin();
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    while(cin >> d && d){
        b.resize(d+3);
        rep(i,d+3) cin >> b[i];
        cout << solve() << endl;
    }
}