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 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-6;
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);
    auto col = iota(0, W, 1).array;
    foreach (int i; 0 .. H) {
        int p = i;
        int q = i;
        foreach (int j; i .. H) {
            foreach (int k; i .. W) {
                if (j == i && k == i) continue;
                if (abs(A.get(j, k)) > abs(A.get(p, q))) {
                    p = j;
                    q = k;
                }
            }
        }
        if (EQ(A.get(p, q), 0)) continue;
        A.swapRows(p, i);
        A.swapCols(q, i);
        swap(col[q], col[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 - 1) {
        foreach_reverse (j; 0 .. i - 1) {
            real x = A.get(j, i);
            foreach (k; i .. W) {
                A.at(j, k) -= x * A.get(i, k);
            }
        }
    }
    auto R = new Matrix!real(H, W);
    foreach (i; 0 .. H) {
        foreach (j; 0 .. W) {
            R.at(i, col[j]) = A.get(i, j);
        }
    }
    foreach (i; 0 .. H) {
        foreach (j; i .. H) {
            if (EQ(R.get(j, i), 1)) {
                R.swapRows(i, j);
                break;
            }
        }
    }
    return R;
}

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();
}
 

Measured memory_bytes: 3064