import java.lang.Math.*

fun main(args: Array<String>?): Unit {
    while(true) {
        val n = readLine()!!.trim().toInt()
        if (n == 0) break
        val vertex = Array(n){
            val (x, y) = readLine()!!.trim().split(' ').map(String::toDouble)
            Point(x, y)
        }
        val angles = vertex.indices.map{i ->
            val h = (i + n - 1) % n
            val j = (i + 1) % n
            val ih = (vertex[h] - vertex[i]).toVec().toAngle()
            val ij = (vertex[j] - vertex[i]).toVec().toAngle()
            AngleRange(vertex[i], ij, ih)
        }
        val lines = vertex.indices.map{i -> Line(vertex[i], vertex[(i + 1) % n])}
        val crossPoint = lines.indices.flatMap{i -> (0 until i).mapNotNull{j -> lines[i].crossPoints(lines[j])}}
        println(
                if (crossPoint.any{p -> angles.all{a -> a.contains(p)}}) 1 else 0
        )
    }
}
const val EPSILON: Double = 1e-9
data class AngleRange(val origin: Point, val min: Angle, val max: Angle) {
    private val rad = (max - min).toRad()
    operator fun contains(that: Point): Boolean {
        return ((that - origin).toVec().toAngle() - min).toRad().let{a -> (a in (-EPSILON .. rad + EPSILON) || (a - PI * 2) in (-EPSILON .. rad + EPSILON))}
    }
}
data class Angle(val sin: Double, val cos: Double) {
    fun toRad(): Double = Math.atan2(sin, cos).let{if (it < 0) it + 2 * PI else it}
    operator fun minus(that: Angle): Angle = Angle(sin * that.cos - cos * that.sin, cos * that.cos + sin * that.sin)
}
data class Point(val x: Double, val y: Double) {
    operator fun minus(that: Point): Point = Point(x - that.x, y - that.y)
    fun toVec(): Vector = Vector(x, y)
}
data class Vector(val x: Double, val y: Double){
    val length: Double
        get() = sqrt(x * x + y * y)
    fun toAngle(): Angle {
        val len = length
        return Angle(y / len, x / len)
    }
}
class Line(private val a: Double, private val b: Double, private val c: Double) {
    private constructor(ax: Double, dy: Double, ay: Double, dx: Double):this(ay, -ax, ax * dy - ay * dx)
    constructor(pa: Point, pb: Point):this(pa.x - pb.x, pb.y, pa.y - pb.y, pb.x)
    fun crossPoints(that: Line): Point? {
        val d = a * that.b - b * that.a
        return if (abs(d) < 1e-9) {
            null
        }
        else {
            Point((b * that.c - c * that.b) / d, (c * that.a - a * that.c) / d)
        }
    }
}

