output_description: For each dataset, output _i_ in a line when _v i_ is wrong.
input_description: The input is a sequence of datasets, each representing a calculation result in
  the following format.
  
  _d_  
  _v_ 0  
  _v_ 1  
  ...  
  _v_ _d_ +2  
  
  Here, _d_ in the first line is a positive integer that represents the degree
  of the polynomial, namely, the highest exponent of the variable. For instance,
  the degree of 4 _x_ 5 \+ 3 _x_ \+ 0.5 is five and that of 2.4 _x_ \+ 3.8 is
  one. _d_ is at most five.
  
  The following _d_ \+ 3 lines contain the calculation result of _f_(0), _f_(1),
  ... , and _f_(_d_ \+ 2) in this order, where _f_ is the polynomial function.
  Each of the lines contains a decimal fraction between -100.0 and 100.0,
  exclusive.
  
  You can assume that the wrong value, which is exactly one of _f_(0), _f_(1),
  ... , and _f_(_d_ +2), has an error greater than 1.0. Since rounding errors
  are inevitable, the other values may also have errors but they are small and
  never exceed 10-6.
  
  The end of the input is indicated by a line containing a zero.
attempt: from functools import reduce
  
  EPSILON = 2e-6
  d = 0
  Vs = []
  
  times = lambda x, y: x * y
  
  
  def interpolate(x, e):
      return sum(
          reduce(times, [(x - j) / (i - j) for j in range(len(Vs)) if j not in [i, x, e]])
          * v
          for i, v in enumerate(Vs)
          if i not in [x, e]
      )
  
  
  def outlier(e):
      for i, v in enumerate(Vs):
          if i == e:
              continue
          if abs(interpolate(i, e) - v) < EPSILON:
              return False
      return True
  
  
  def solve():
      for i in range(d + 3):
          if not outlier(i):
              return i
      return -1
  
  
  while True:
      d = int(input())
      if d == 0:
          break
      Vs = [float(input()) for i in range(d + 3)]
      print(solve())
  
problem_description: D:  Find the Outlier
  
  Professor Abacus has just built a new computing engine for making numerical
  tables. It was designed to calculate the values of a polynomial function in
  one variable at several points at a time. With the polynomial function
  _f_(_x_) = _x_ 2 \+ 2 _x_ \+ 1, for instance, a possible expected calculation
  result is 1 (= _f_(0)), 4 (= _f_(1)), 9 (= _f_(2)), 16 (= _f_(3)), and 25 (=
  _f_(4)).
  
  It is a pity, however, the engine seemingly has faulty components and exactly
  one value among those calculated simultaneously is always wrong. With the same
  polynomial function as above, it can, for instance, output 1, 4, 12, 16, and
  25 instead of 1, 4, 9, 16, and 25.
  
  You are requested to help the professor identify the faulty components. As the
  first step, you should write a program that scans calculation results of the
  engine and finds the wrong values.
samples: [{"input": "1.0\n    4.0\n    12.0\n    16.0\n    25.0\n    1\n    -30.5893962764\n    5.76397083962\n    39.3853798058\n    74.3727663177\n    4\n    42.4715310246\n    79.5420238202\n    28.0282396675\n    -30.3627807522\n    -49.8363481393\n    -25.5101480106\n    7.58575761381\n    5\n    -21.9161699038\n    -48.469304271\n    -24.3188578417\n    -2.35085940324\n    -9.70239202086\n    -47.2709510623\n    -93.5066246072\n    -82.5073836498\n    0", "output": "1\n    1\n    6"}]