pi = 2 * Math.atan2(1,0)
epsilon = 1e-12

n = gets.to_i
p = []
n.times{|i|
  p[i] = gets.split.map(&:to_f)
}
p << p[0]

q = gets.to_i
q.times{
  x, y = gets.split.map(&:to_f)
  sum = 0
  on_line_flag = false
  n.times{|i|
    v0 = [p[i][0] - x, p[i][1] - y]
    r0 = Math.sqrt(v0[0]*v0[0]+v0[1]*v0[1])
    v1 = [p[i+1][0] - x, p[i+1][1] - y]
    r1 = Math.sqrt(v1[0]*v1[0]+v1[1]*v1[1])
    sum += Math.acos((v0[0]*v1[0]+v0[1]*v1[1])/(r0 * r1))
    v2 = [p[i+1][0]-p[i][0], p[i+1][1] - p[i][1]]
    r2 = Math.sqrt(v2[0]*v2[0]+v2[1]*v2[1])
    if (v0[0]*v2[0]+v0[1]*v2[1])/(r0*r2) == -1 && r2 >= r1
      on_line_flag = true
      next
    end
  }
  if on_line_flag
    puts 1
  elsif (sum - 2.0 * pi).abs < epsilon
    puts 2
  else
    puts 0
  end
}