#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

constexpr double EPS = 1e-9;

struct point {
	double x, y;
	point(double x_ = 0.0, double y_ = 0.0):x(x_), y(y_) {}
	point(const point &p):x(p.x), y(p.y) {}

	point operator+(const point &p) const {
		return point(x + p.x, y + p.y);
	}

	point operator-(const point &p) const {
		return point(x - p.x, y - p.y);
	}

	point operator*(double s) const {
		return point(x * s, y * s);
	}
};

double norm(const point &p) {
	return p.x * p.x + p.y * p.y;
}

double dot(const point &a, const point &b) {
	return a.x * b.x + a.y * b.y;
}

double cross(const point &a, const point &b) {
	return a.x * b.y - a.y * b.x;
}

struct line {
	point a, b;
	line(const point &a_, const point &b_):a(a_), b(b_){}
};

typedef vector<point> polygon;

int ccw(const point &a, point b, point c) {
	b = b - a;
	c = c - a;
	const double tmp = cross(b, c);
	if(tmp > EPS) return 1; // ccw
	if(tmp < -EPS) return -1; // cw
	if(dot(b, c) < 0) return 2; // c, a, b 順に一直線上
	if(norm(b) < norm(c)) return -2; // a, b, c 順に一直線上
	return 0; //a, c, b 順で一直線上
}

point crosspoint(const line &l, const line &m) {
	const double tmp = cross(l.b - l.a, m.b - m.a);
	if(abs(tmp) < EPS) return l.a; // 平行
	return m.a + (m.b - m.a) * (cross(l.b - l.a, l.a - m.a) / tmp);
}

// L.aからL.bを向いた時の左側を残して切断する．
polygon convex_cut(const polygon &P, const line &l) {
	polygon res;

	point prev = P.back();
	int pc = ccw(l.a, l.b, prev);

	for(const auto &curr : P) {
		const int cc = ccw(l.a, l.b, curr);

		if(pc != -1) {
			res.emplace_back(prev);
		}
		if(pc * cc < 0) {
			res.emplace_back(crosspoint(l, line(prev, curr)));
		}

		prev = curr;
		pc = cc;
	}

	return res;
}

bool ok(const polygon &P) {
	constexpr int MIN = 0;
	constexpr int MAX = 10000;
	polygon rest{point(MIN, MIN), point(MIN, MAX), point(MAX, MAX), point(MAX, MIN)};

	point prev = P.back();
	for(const auto &curr : P) {
		rest = convex_cut(rest, line(prev, curr));
		if(rest.empty()) return false;
		prev = curr;
	}

	return true;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	for(int n; cin >> n && n;) {
		polygon P(n);
		for(auto &e : P) cin >> e.x >> e.y;
		cout << ok(P) << endl;
	}

	return EXIT_SUCCESS;
}