#include<cmath>
#include<vector>
#include<complex>
#include<algorithm>

#define	pb			push_back
#define	rep(i,n)	for(int i=0;i<n;i++)

using namespace std;

typedef	complex<double>	Point;
typedef	vector<Point>	Polygon;

const double EPS=1e-7;

namespace std{
	bool operator <(const Point &a,const Point &b){
		return abs(real(a)-real(b))<EPS?(imag(a)+EPS<imag(b)):(real(a)+EPS<real(b));
	}
	bool operator >(const Point &a,const Point &b){
		return b<a;
	}
}

enum {CCW=1,CW=-1,ON=0};

class Line:public vector<Point>{
public:
	Line(){}
	Line(const Point &a,const Point &b){
		pb(a),pb(b);
	}
};

class Segment:public Line{
public:
	Segment(){}
	Segment(const Point &a,const Point &b):Line(a,b){}
};

double dot(const Point &a,const Point &b){
	return real(a)*real(b)+imag(a)*imag(b);
}

double cross(const Point &a,const Point &b){
	return real(a)*imag(b)-imag(a)*real(b);
}

int ccw(const Point &a,Point b,Point c){
	b-=a,c-=a;
	double rotdir=cross(b,c);
	if(rotdir>EPS)		return CCW;
	if(rotdir<-EPS)		return CW;
	return ON;
}

inline void calc_abc(const Line &l,double &a,double &b,double &c){	// l : ax+by+c=0
	a=imag(l[0])-imag(l[1]);
	b=real(l[1])-real(l[0]);
	c=cross(l[0],l[1]);
}

bool intersect(const Line &l,const Line &m,Point *p=NULL){
	// this routine also returns true in case "M is on L", etc,.
	if(abs(cross(l[1]-l[0],m[1]-m[0]))>EPS
	|| abs(cross(l[1]-l[0],m[0]-l[0]))<EPS){
		if(p){
			double a1,b1,c1,a2,b2,c2;
			calc_abc(l,a1,b1,c1);
			calc_abc(m,a2,b2,c2);
			double det=a1*b2-a2*b1;
			if(abs(det)<EPS)	*p=l[0];	// l==m
			else				*p=Point(b1*c2-b2*c1,a2*c1-a1*c2)/det;
		}
		return true;
	}
	return false;
}

bool intersect(const Segment &s,const Segment &t,Point *p=NULL){
	if(max(real(s[0]),real(s[1]))<min(real(t[0]),real(t[1]))
	|| max(real(t[0]),real(t[1]))<min(real(s[0]),real(s[1]))
	|| max(imag(s[0]),imag(s[1]))<min(imag(t[0]),imag(t[1]))
	|| max(imag(t[0]),imag(t[1]))<min(imag(s[0]),imag(s[1])))	return false;

	if(ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1])<=0
	&& ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1])<=0){
		if(p){
			double a1,b1,c1,a2,b2,c2;
			calc_abc(s,a1,b1,c1);
			calc_abc(t,a2,b2,c2);
			double det=a1*b2-a2*b1;
			if(abs(det)<EPS){	// s is parallel to t
				Point q[3]={s[0],s[1],t[0]};
				rep(i,3){
					if(dot(q[i]-s[0],q[i]-s[1])<EPS && dot(q[i]-t[0],q[i]-t[1])<EPS){
						*p=q[i];
						break;
					}
				}
			}
			else	*p=Point(b1*c2-b2*c1,a2*c1-a1*c2)/det;
		}
		return true;
	}
	return false;
}

bool contain(const Polygon &g,const Point &p){
	int n=g.size();
	bool in=false;
	rep(i,n){
		Point v1=g[i]-p,v2=g[(i+1)%n]-p;
		if(imag(v1)>imag(v2))	swap(v1,v2);
		// include lower vertex, not include upper vertex
		if(imag(v1)<EPS && EPS<imag(v2) && cross(v1,v2)>EPS)	in=!in;	// alternate
		if(abs(cross(v1,v2))<EPS && dot(v1,v2)<EPS)	return true;	// p is on g[i]-g[i+1]
	}
	return in;
}

#include<cstdio>

bool isViewableAllVertices(const Polygon &g,const Point &p){
	int n=g.size();

	rep(i,n)if(abs(g[i]-p)>EPS){	// for each vertex g[i](!=p) in g
		Point u=g[i]-p; u/=abs(u);
		if(!contain(g,p+1e-5*u) || !contain(g,g[i]-1e-5*u))	return false;

		Segment s(p,g[i]);
		rep(j,n){	// for each side t in g
			Segment t(g[j],g[(j+1)%n]);
			Point q;
			// p-q-g[i] is on the same line (this order)
			if(intersect(s,t,&q)){
				// if q != p, g[i]
				if(abs(q-p)>EPS && abs(g[i]-q)>EPS){
					if(!contain(g,q-1e-5*u) || !contain(g,q+1e-5*u))	return false;
				}
			}
		}
	}

	return true;
}

int main(){
	for(int n;scanf("%d",&n),n;){
		Polygon g;
		rep(i,n){
			int x,y;	scanf("%d%d",&x,&y);
			g.pb(Point(x,y));
		}

		bool b=false;
		rep(i,n)rep(j,i){
			Point p;
			Line l(g[i],g[(i+1)%n]),m(g[j],g[(j+1)%n]);
			if(intersect(l,m,&p) && contain(g,p)){
				if(isViewableAllVertices(g,p)){ b=true; goto FOUND; }
			}
		}

		FOUND:
		puts(b?"1":"0");
	}

	return 0;
}

Measured memory_bytes: 800