### constant

ERROR = 1.0

### subroutines

def solve_eqn(n, mat, v)
  #p [mat, v]
  
  for i in (0...n)
    if mat[i][i] == 0
      for j in ((i + 1)...n)
        if mat[j][i] != 0
          tmp = mat[i]; mat[i] = mat[j]; mat[j] = tmp;
          tmp = v[i]; v[i] = v[j]; v[j] = tmp
          break
        end
      end
    end

    mii = mat[i][i]
    if mii != 1
      (i...n).each{|j| mat[i][j] /= mii}
      v[i] /= mii
    end

    for j in ((i + 1)...n)
      mji = mat[j][i]
      (i...n).each{|k| mat[j][k] -= mji * mat[i][k]}
      v[j] -= mji * v[i]
    end
  end
  #p [mat, v]

  (n - 1).downto(0) do |i|
    ((i + 1)...n).each{|j| v[i] -= mat[i][j] * v[j]}
  end
  #p v; exit

  v
end

### main

loop do
  d = gets.to_i
  break if d == 0

  v = Array.new(d + 3){gets.to_f}
  #p v

  mat = Array.new(d + 3){[]}
  for i in (0..(d + 2))
    for j in (0..d)
      mat[i][j] = i ** j
    end
  end
  #p mat

  found = nil

  for i0 in (0..(d + 2))
    for i1 in ((i0 + 1)..(d + 2))
      mat0 = []
      v0 = []
      for k in (0..(d + 2))
        if k != i0 && k != i1
          mat0 << mat[k].map{|col| Rational(col)}
          v0 << v[k]
        end
      end
      #p [mat0, v0]

      solve_eqn(d + 1, mat0, v0)
      #p v0; exit

      count = 0
      i = nil

      w0 = 0.0
      (0..d).each{|j| w0 += mat[i0][j] * v0[j]}
      if (w0 - v[i0]).abs > ERROR
        count += 1
        i = i0
      end

      w1 = 0.0
      (0..d).each{|j| w0 += mat[i1][j] * v0[j]}
      if (w0 - v[i1]).abs > ERROR
        count += 1
        i = i1
      end

      if count == 1
        found = i
        break
      end
    end
    break if found
  end

  puts found
end