while 1:

    d = eval(input())

    if d==0:

        break

    V = [float(input()) for i in range(d+3)]



    a = [0]*(d+3)

    cnts = [0]*(d+3)

    import itertools

    for K in itertools.combinations(list(range(d+3)), d+1):

        for k in K:

            res = 1

            for j in K:

                if k==j: continue

                res *= k-j

            a[k] = V[k] / res

        for i in range(d+3):

            if i in K: continue

            res = 0.

            for k in K:

                tmp = 1

                for j in K:

                    if k==j: continue

                    tmp *= i-j

                res += a[k]*tmp

            if abs(V[i]-res) > 0.5:

                cnts[i] += 1

    print(cnts.index(max(cnts)))
from itertools import combinations



def build(X, Y):

    A = []

    for x in X:

        res = 1

        for xi in X:

            if x == xi:

                continue

            res *= x - xi

        A.append(Y[x] / res)

    return A



def calc(X, A, x):

    base = 1

    for xi in X:

        base *= i - xi

    return sum(base / (i - x) * a for x, a in zip(X, A))





while 1:

    d = int(eval(input()))

    if d == 0:

        break

    N = d+3

    Y = [float(eval(input())) for i in range(N)]



    cnts = [0]*N

    for X in combinations(list(range(N)), d+1):

        U = [0]*N

        for x in X:

            U[x] = 1

        A = build(X, Y)



        for i in range(N):

            if U[i]:

                continue

            res = calc(X, A, i)



            if abs(Y[i] - res) > 0.5:

                cnts[i] += 1

    print((cnts.index(max(cnts))))



while 1:
    d = eval(input())
    if d == 0:
        break
    V = [float(input()) for i in range(d + 3)]
    a = [0] * (d + 3)
    cnts = [0] * (d + 3)
    import itertools

    for K in itertools.combinations(list(range(d + 3)), d + 1):
        for k in K:
            res = 1
            for j in K:
                if k == j:
                    continue
                res *= k - j
            a[k] = V[k] / res
        for i in range(d + 3):
            if i in K:
                continue
            res = 0.0
            for k in K:
                tmp = 1
                for j in K:
                    if k == j:
                        continue
                    tmp *= i - j
                res += a[k] * tmp
            if abs(V[i] - res) > 0.5:
                cnts[i] += 1
    print(cnts.index(max(cnts)))

from itertools import combinations


def build(X, Y):
    A = []
    for x in X:
        res = 1
        for xi in X:
            if x == xi:
                continue
            res *= x - xi
        A.append(Y[x] / res)
    return A


def calc(X, A, x):
    base = 1
    for xi in X:
        base *= i - xi
    return sum(base / (i - x) * a for x, a in zip(X, A))


while 1:
    d = int(eval(input()))
    if d == 0:
        break
    N = d + 3
    Y = [float(eval(input())) for i in range(N)]
    cnts = [0] * N
    for X in combinations(list(range(N)), d + 1):
        U = [0] * N
        for x in X:
            U[x] = 1
        A = build(X, Y)
        for i in range(N):
            if U[i]:
                continue
            res = calc(X, A, i)
            if abs(Y[i] - res) > 0.5:
                cnts[i] += 1
    print((cnts.index(max(cnts))))

+from itertools import combinations + + +def build(X, Y): +    A = [] +    for x in X: +        res = 1 +        for xi in X: +            if x == xi: +                continue +            res *= x - xi +        A.append(Y[x] / res) +    return A + + +def calc(X, A, x): +    base = 1 +    for xi in X: +        base *= i - xi +    return sum(base / (i - x) * a for x, a in zip(X, A)) + + -    d = eval(input()) +    d = int(eval(input())) -    V = [float(input()) for i in range(d + 3)] -    a = [0] * (d + 3) -    cnts = [0] * (d + 3) -    import itertools - -    for K in itertools.combinations(list(range(d + 3)), d + 1): -        for k in K: -            res = 1 -            for j in K: -                if k == j: -                    continue -                res *= k - j -            a[k] = V[k] / res -        for i in range(d + 3): -            if i in K: +    N = d + 3 +    Y = [float(eval(input())) for i in range(N)] +    cnts = [0] * N +    for X in combinations(list(range(N)), d + 1): +        U = [0] * N +        for x in X: +            U[x] = 1 +        A = build(X, Y) +        for i in range(N): +            if U[i]: -            res = 0.0 -            for k in K: -                tmp = 1 -                for j in K: -                    if k == j: -                        continue -                    tmp *= i - j -                res += a[k] * tmp -            if abs(V[i] - res) > 0.5: +            res = calc(X, A, i) +            if abs(Y[i] - res) > 0.5: -    print(cnts.index(max(cnts))) +    print((cnts.index(max(cnts))))