#define  _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-5L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define seg_size 262144LL
#define MOD 998244353LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

// geometry library

typedef complex<long double> Point;
typedef pair<complex<long double>, complex<long double>> Line;

typedef struct Circle {
    complex<long double> center;
    long double r;
}Circle;

//内積、 dot(a,b) = |a||b|cos()
long double dot(Point a, Point b) {
    return (a.real() * b.real() + a.imag() * b.imag());
}
//外積、cross(a,b) = |a||b|sin()
long double cross(Point a, Point b) {
    return (a.real() * b.imag() - a.imag() * b.real());
}

//線分と点の距離
long double Dist_Line_Point(Line a, Point b) {
    if (dot(a.second - a.first, b - a.first) < eps) return abs(b - a.first);
    if (dot(a.first - a.second, b - a.second) < eps) return abs(b - a.second);
    return abs(cross(a.second - a.first, b - a.first)) / abs(a.second - a.first);
}

//線分の交差判定
int is_intersected_ls(Line a, Line b) {
    return (cross(a.second - a.first, b.first - a.first) * cross(a.second - a.first, b.second - a.first) < 0) &&
        (cross(b.second - b.first, a.first - b.first) * cross(b.second - b.first, a.second - b.first) < 0);
}

//線分の交点
Point intersection_l(Line a, Line b) {
    Point da = a.second - a.first;
    Point db = b.second - b.first;
    return a.first + da * cross(db, b.first - a.first) / cross(db, da);
}

//線分と線分の距離
long double Dist_Line_Line(Line a, Line b) {
    if (is_intersected_ls(a, b) == 1) {
        return 0;
    }
    return min({ Dist_Line_Point(a,b.first), Dist_Line_Point(a,b.second),Dist_Line_Point(b,a.first),Dist_Line_Point(b,a.second) });
}

//円と円の交点
pair<Point, Point> intersection_Circle_Circle(Circle a, Circle b) {
    long double dist = abs(a.center - b.center);
    assert(dist <= eps + a.r + b.r);
    assert(dist+eps >= abs(a.r - b.r));
    Point target = b.center - a.center;
    long double pointer = target.real() * target.real() + target.imag() * target.imag();
    long double aa = pointer + a.r * a.r - b.r * b.r;
    aa /= 2.0L;
    Point l{ (aa * target.real() + target.imag() * sqrt(pointer * a.r * a.r - aa * aa))/pointer,
            (aa* target.imag() - target.real() * sqrt(pointer * a.r * a.r - aa * aa)) / pointer};
    Point r{ (aa * target.real() - target.imag() * sqrt(pointer * a.r * a.r - aa * aa)) / pointer,
        (aa * target.imag() + target.real() * sqrt(pointer * a.r * a.r - aa * aa)) / pointer };
    r = r + a.center;
    l = l + a.center;
    return mp(l, r);
}

//end of geometry



void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}

unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

#define int ll

template<typename A>
vector<A> solve_algebra_equations(vector<vector<A>> now) {
    for (int q = 0; q < now.size(); ++q) {
        if (now[q][q] == 0) {
            for (int j = q + 1; j < now.size(); ++j) {
                if (now[j][q] != 0) {
                    swap(now[j], now[q]);
                    break;
                }
            }
        }
        for (int j = now[q].size() - 1; j >= 0; --j) {
            now[q][j] /= now[q][q];
        }
        for (int j = 0; j < now.size();++j) {
            if (j == q) continue;
            A val = now[j][q];
            for (int t = 0; t < now[j].size(); ++t) {
                now[j][t] -= val * now[q][t];
            }
        }
    }
    vector<A> ans;
    REP(i, now.size()) {
        ans.push_back(now[i].back());
    }
    return ans;
}

void solve(){
    while (true) {
        int d;
        cin >> d;
        if (d == 0) return;
        vector<long double> inputs;
        REP(i, d + 3) {
            long double a;
            cin >> a;
            inputs.push_back(a);
        }
        int ans = -1;
        REP(i, inputs.size()) {
            for (int q = i + 1; q < inputs.size(); ++q) {
                vector<vector<long double>> neko;
                vector<vector<long double>> check;
                REP(j, inputs.size()) {
                    vector<long double> now;
                    now.push_back(inputs[j]);
                    long double geko = 1;
                    for (int t = 0; t <= d; ++t) {
                        now.push_back(geko);
                        geko *= j;
                    }
                    reverse(ALL(now));
                    if (i == j || q == j) {
                        check.push_back(now);
                    }
                    else {
                        neko.push_back(now);
                    }
                 }
                vector<long double>  geko = solve_algebra_equations<long double>(neko);
                REP(t, 2) {
                    long double now_check = 0;
                    for (int q = 0; q < geko.size(); ++q) {
                        now_check += geko[q] * check[t][q];
                    }
                    if (abs(now_check - check[t].back()) < eps) {
                        if (t == 0) {
                            ans = q;
                        }
                        else {
                            ans = i;
                        }
                        break;
                    }
                }
            }
            if (ans != -1) break;
        }
        cout << ans << endl;
    }
}

#undef int
int main() {
    init();
    solve();
}


Measured memory_bytes: 3204