
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void log(A...)(A arg) {
    stderr.writeln(arg);
}
int size(T)(in T s) {
    return cast(int)s.length;
}

real dot(T)(in T[] a, in T[] b) {
    assert(a.length == b.length);
    return reduce!((sum, i) => sum + a[i] * b[i])(cast(T)0, iota(0, a.length, 1));
}
class Matrix(T) {
    int H, W;
    T[] data;
    this(int H, int W) {
        this.H = H;
        this.W = W;
        this.data = new T[H * W];
    }
    this(int H, int W, T init) {
        this(H, W);
        foreach (i; 0 .. H) foreach (j; 0 .. W) at(i, j) = init;
    }
    this(int H, int W, T delegate(int, int) init) {
        this(H, W);
        foreach (i; 0 .. H) foreach (j; 0 .. W) at(i, j) = init(i, j);
    }
    this(in Matrix A) {
        this.H = A.H;
        this.W = A.W;
        this.data = A.data.dup;
    }
    //pragma(inline, true) {
        ref T at(int i, int j) { return data[i * W + j]; }
        T get(int i, int j) const { return data[i * W + j]; }
        const(T[]) get(int i) const { return data[i * W .. (i + 1) * W]; }
    //}
    Matrix setRow(int i, in T[] xs) { foreach (j; 0 .. W) at(i, j) = xs[j]; return this; }
    Matrix swapRows(int i, int j) { foreach (k; 0 .. W) swap(at(i, k), at(j, k)); return this; }
    Matrix swapCols(int i, int j) { foreach (k; 0 .. H) swap(at(k, i), at(k, j)); return this; }
    Matrix transpose() const { return new Matrix(H, W, (i, j) => get(j, i)); }
    Matrix opBinary(string op)(in Matrix B) const if (op == "+" || op == "-") {
        assert(H == B.H && W == B.W);
        return new Matrix(H, W, (i, j) => mixin("get(i, j) " ~ op ~ " B.get(i, j)"));
    }
    Matrix opBinary(string op)(in Matrix B) const if (op == "*") {
        assert(W == B.H);
        auto X = B.transpose;
        auto A = new Matrix(H, B.W, 0);
        foreach (i; 0 .. H) foreach (j; 0 .. X.H) {
            foreach (k; 0 .. W) {
                A.at(i, j) += get(i, k) * X.get(j, k);
            }
        }
        return A;
    }
    T[] opBinary(string op)(in T[] b) const if (op == "*") {
        auto y = new T[b.length];
        foreach (i; 0 .. H) y[i] = dot(get(i), b);
        return y;
    }
    override string toString() const { return to!string(iota(0, H, 1).map!((i) => data[i * W .. (i + 1) * W]).array); }
}

immutable EPS = 1e-4;
bool EQ(real a, real b) { return abs(a - b) < EPS; }
Matrix!real gaussianElimination(in Matrix!real X) {
    // assume that X.H <= X.W
    auto A = new Matrix!real(X);
    int H = A.H, W = A.W;
    auto L = new Matrix!real(H, W, 0);
    auto P = new Matrix!real(H, W, 0);
    foreach (int i; 0 .. H) {
        int p = i;
        foreach (int j; i + 1 .. H) {
            if (abs(A.get(j, i)) > abs(A.get(p, i))) {
                p = j;
            }
        }
        if (EQ(A.get(p, i), 0)) continue;
        A.swapRows(p, i);
        real x = A.get(i, i);
        foreach (j; i .. W) A.at(i, j) /= x;
        foreach (k; i + 1 .. H) {
            real y = A.get(k, i);
            foreach (l; i .. W) {
                A.at(k, l) -= y * A.get(i, l);
            }
        }
    }
    foreach_reverse (i; 0 .. H) {
        foreach_reverse (j; 0 .. i) {
            real x = A.get(j, i);
            foreach (k; i .. W) {
                A.at(j, k) -= x * A.get(i, k);
            }
        }
    }
    return A;
}

void main() {
    int D;
    real[] V;
    bool input() {
        D = readln.chomp.to!int;
        if (D == 0) return false;
        V = new real[D + 3];
        foreach (ref v; V) {
            v = readln.chomp.to!real;
        }
        return true;
    }
 
    void solve() {
        for (int d = 0; d < D + 3; d++) {
            // assume f(d) is the outlier;
            auto M = new Matrix!real(D + 2, D + 2, 0);
            for (int i = 0, p = 0; i < D + 3; i++) {
                if (i == d) continue;
                for (int j = 0; j < D + 1; j++) {
                    M.at(p, j) = pow(i, j);
                }
                M.at(p, D + 1) = V[i];
                p++;
            }
            auto A = gaussianElimination(M);
            if (EQ(A.get(D + 1, D + 1), 0)) {
                writeln(d);
                return;
            }
        }
        assert(false);
    }

    while (input()) solve();
}
 