#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;

#define dump(a) (cerr << (#a) << " = " << (a) << endl)

template<class T> inline void chmax(T& a, const T& b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << '(' << p.first << ", " << p.second << ')';
	return os;
}

template<class Tuple, unsigned Index>
void print_tuple(ostream& os, const Tuple& t) {}

template<class Tuple, unsigned Index, class Type, class... Types>
void print_tuple(ostream& os, const Tuple& t) {
	if(Index > 0) os << ", ";
	os << get<Index>(t);
	print_tuple<Tuple, Index + 1, Types...>(os, t);
}

template<class... Types>
ostream& operator<<(ostream& os, const tuple<Types...>& t) {
	os << '(';
	print_tuple<tuple<Types...>, 0, Types...>(os, t);
	return os << ')';
}

template<class Iterator>
ostream& dump_range(ostream&, Iterator, const Iterator&);

template<typename T>
ostream& operator<<(ostream& os, vector<T> c) {
	return dump_range(os, c.cbegin(), c.cend());
}

template<class Iterator>
ostream& dump_range(ostream& os, Iterator first, const Iterator& last) {
	os << '[';
	for(int i = 0; first != last; ++i, ++first) {
		if(i) os << ", ";
		os << *first;
	}
	return os << ']';
}

constexpr double EPS = 1e-4;
typedef vector<double> vec;
typedef vector<vec> mat;

vec gauss_jordan(mat A) {
	const int n = static_cast<int>(A.size());
	for(int i = 0; i < n; ++i) {
		int pivot = i;
		for(int j = i; j < n; ++j) {
			if(abs(A[j][i]) > abs(A[pivot][i])) pivot = j;
		}
		A[i].swap(A[pivot]);

		if(abs(A[i][i]) < EPS) return vec();

		for(int j = i + 1; j <= n; ++j)
			A[i][j] /= A[i][i];

		for(int j = 0; j < n; ++j) {
			if(i != j) {
				for(int k = i + 1; k <= n; ++k)
					A[j][k] -= A[j][i] * A[i][k];
			}
		}
	}

	vec x(n);
	for(int i = 0; i < n; ++i)
		x[i] = A[i][n];

	return x;
}

struct compare {
	bool operator() (const vec& a, const vec& b) {
		if(a.size() != b.size()) return a.size() < b.size();
		const int n = static_cast<int>(a.size());
		for(int i = 0; i < n; ++i) {
			if(abs(a[i] - b[i]) > EPS) return a[i] + EPS < b[i];
		}
		return false;
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	for(int d; cin >> d, d;) {
		const int n = d + 3;
		vector<vec> expressions(n);
		for(int i = 0; i < n; ++i) {
			expressions[i].reserve(d + 2);
			for(int j = d; j >= 0; --j) {
				expressions[i].push_back(pow(i, j));
			}

			double value;
			cin >> value;
			expressions[i].push_back(value);
		}

		map<vec, int, compare> pattern;
		for(int i = 0; i < n; ++i) {
			for(int j = 0; j < n; ++j) {
				if(i == j) continue;

				mat A;
				A.reserve(n - 2);
				for(int k = 0; k < n; ++k) {
					if(i != k && j != k) A.push_back(expressions[k]);
				}

				vec ans = gauss_jordan(A);
				int& t = pattern[ans];
				for(int k = 0; k < n; ++k) {
					if(i != k && j != k) t |= (1 << k);
				}
			}
		}

		int correct = -1;
		for(const auto& e : pattern) {
			if(__builtin_popcount(e.second) == n - 1) {
				correct = e.second;
				break;
			}
		}

		assert(correct != -1);

		for(int i = 0; i < n; ++i) {
			if(!(correct & (1 << i))) {
				cout << i << endl;
				break;
			}
		}
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1336