#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

#define phb push_back

using namespace std;

typedef vector< double > Row;
typedef vector< Row > Matrix;

const double kEps = 1e-4;

int D;
double V[10];

void read();
void soups_on();
bool yee_haw(int);
Row sugar_cube(Matrix &);

inline bool feq(double x, double y) { return abs(x - y) < kEps; }

int main() {
  while (cin >> D, D)
    read(), soups_on();

  return 0;
}

void read() {
  for (int i = 0; i < D + 3; ++i)
    cin >> V[i];
}

void soups_on() {
  for (int i = 0; i < D + 3; ++i)
    if (yee_haw(i)) {
      cout << i << "\n";
      break;
    }
}

bool yee_haw(int wv) {
  Matrix mtrx;
  double x, res;
  bool ret = false;

  for (int i = 0, j = 0; i < D + 3; ++i) {
    if (i == wv)
      continue;

    if (j < D + 1) {
      mtrx.phb(Row(D + 2)), x = 1.0;
      for (int k = D; k >= 0; --k, x *= double(i))
        mtrx[j][k] = x;
      mtrx[j][D + 1] = V[i];
    }
    else {
      Row coef = sugar_cube(mtrx);
      res = 0.0, x = 1.0;
      for (int k = D; k >= 0; --k, x *= double(i))
        res += x * coef[k];
      ret = !(abs(res - V[i]) + kEps > 1.0);
    }

    ++j;
  }

  return ret;
}

Row sugar_cube(Matrix &rm) {
  Row ret(D + 1);
  int i, j, r, c;
  double f;

  r = c = 0;
  for (r = 0; r < D + 1; ++r, ++c) {
    i = r;
    while (feq(rm[i][c], 0.0))
      ++i;

    if (i != r)
      swap(rm[r], rm[i]);

//    cout << "i = " << i << ", r = " << r << endl;
    for (i = 0; i < D + 1; ++i) {
      if (i == r)
        continue;

      f = -rm[i][c] / rm[r][c];
      for (j = 0; j <= D + 1; ++j)
        rm[i][j] += f * rm[r][j];
    }
  }

  for (r = 0; r < D + 1; ++r)
    for (c = 0; c < D + 1; ++c)
      if (!feq(rm[r][c], 0.0)) {
        ret[c] = rm[r][D + 1] / rm[r][c];
        break;
      }

  return ret;
}