### constants

MIN_X = MIN_Y = -10.0
MAX_X = MAX_Y = 10010.0

### classes

class Pt
  attr_accessor :x, :y

  def initialize(x, y)
    @x = x
    @y = y
  end

  def +(pt)
    Pt.new(@x + pt.x, @y + pt.y)
  end

  def -(pt)
    Pt.new(@x - pt.x, @y - pt.y)
  end

  def -@
    Pt.new(-@x, -@y)
  end
  
  def *(t)
    Pt.new(@x * t, @y * t)
  end
  
  def /(t)
    Pt.new(@x / t, @y / t)
  end

  def dot(v)
    @x * v.x + @y * v.y
  end
  
  def cross(v)
    @x * v.y - @y * v.x
  end

  def to_s
    "(#{@x},#{@y})"
  end
end

### subroutines

def cross_lines(a0, a1, b0, b1)
  da = a1 - a0
  db = b1 - b0

  op01 = da.cross(db)
  return nil if op01 == 0.0

  v = b0 - a0
  op0 = v.cross(da)
  op1 = v.cross(db)

  t0 = op1 / op01
  t1 = op0 / op01

  [db * t1 + b0, t0, t1]
end

def convex_cut(cpol, pt0, pt1)
  n = cpol.length
  v = pt1 - pt0
  cpol0 = []

  for i in (0...n)
    cpt0 = cpol[i]
    cr0 = v.cross(cpt0 - pt0)
    if cr0 >= 0.0
      cpol0 << cpt0
    end
    
    cpt1 = cpol[(i + 1) % n]
    cr1 = v.cross(cpt1 - pt0)
    if cr0 * cr1 < 0.0
      pt, t0, t1 = cross_lines(pt0, pt1, cpt0, cpt1)
      cpol0 << pt
    end
  end

  #p cpol0.map{|pt| pt.to_s}; exit
  cpol0
end
 
### main

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

  pts = n.times.map{Pt.new(*gets.split.map(&:to_f))}
  #p pts.map{|pt| pt.to_s}

  cpol = []
  cpol << Pt.new(MIN_X, MIN_Y)
  cpol << Pt.new(MAX_X, MIN_Y)
  cpol << Pt.new(MAX_X, MAX_Y)
  cpol << Pt.new(MIN_X, MAX_Y)
  
  for i in (0...n)
    cpol = convex_cut(cpol, pts[i], pts[(i + 1) % n])
    break if cpol.empty?
  end
  #p cpol.map{|pt| pt.to_s}; exit
  
  puts (cpol.empty? ? 0 : 1)
end