#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<class T> pair<int, T> gauss_jordan(VV<T>& A) {
  int n = A.size(), m = A[0].size(), r = 0;
  T det = 1;
  for (int j = 0; j < m; ++j) {
    for (int i = r + 1; i < n; ++i) if (A[i][j]) {
      swap(A[r], A[i]);
      det = -det;
      break;
    }
    if (!A[r][j]) continue;
    det *= A[r][j];
    auto inv = (T) 1 / A[r][j];
    for (auto&& e : A[r]) e *= inv;
    for (int i = 0; i < n; ++i) if (i != r and A[i][j]) {
      auto c = A[i][j];
      for (int k = 0; k < m; ++k) {
        A[i][k] -= c * A[r][k];
      }
    }
    if (++r == n) break;
  }
  return {r, det * (r == n)};
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  using R = long double;
  constexpr R eps = 1e-3;
  auto chk = [&](const V< pair<int, R> >& a) -> bool {
    int d = a.size() - 2;
    VV<R> A(d + 1, V<R>(d + 2));
    for (int i = 0; i <= d; ++i) {
      for (int j = 0; j <= d; ++j) {
        A[i][j] = pow(a[i].first, j);
      }
      A[i][d + 1] = a[i].second;
    }
    int rank = gauss_jordan(A).first;
    assert(rank == d + 1);
    double x = 0;
    for (int i = 0; i <= d; ++i) {
      x += A[i].back() * pow(a.back().first, i);
    }
    auto err = abs(a.back().second - x);
    return err < eps;
  };
  while (true) {
    int d; cin >> d;
    if (!d) break;
    V<R> v(d + 3); for (auto&& e : v) cin >> e;
    for (int i = 0; i < d + 3; ++i) {
      V< pair<int, R> > a;
      for (int j = 0; j < d + 3; ++j) if (j != i) {
        a.emplace_back(j, v[j]);
      }
      if (chk(a)) {
        cout << i << '\n';
        break;
      }
    }
  }
}
