#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;

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

enum {CCW=1,CW=-1,ON=0};
const double EPS=1e-7;

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){
	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){
	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];
			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);
		if(imag(v1)<EPS && EPS<imag(v2) && cross(v1,v2)<-EPS)	in=!in;
		if(abs(cross(v1,v2))<EPS && dot(v1,v2)<EPS)	return true;
	}
	return in;
}

#include<cstdio>

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));
		}

		vector<Point> candi;
		rep(i,n)rep(j,i){
			Line l(g[i],g[(i+1)%n]),m(g[j],g[(j+1)%n]);
			Point p;
			if(intersect(l,m,&p) && contain(g,p))	candi.pb(p);
		}

		rep(k,candi.size()){
			bool b=true;
			Point p=candi[k];
			rep(i,n)if(abs(g[i]-p)>EPS){
				Point u=g[i]-p; u/=abs(u);
				if(!contain(g,p+1e-5*u) || !contain(g,g[i]-1e-5*u)){ b=false; break; }

				Segment s(p,g[i]);
				rep(j,n){
					Segment t(g[j],g[(j+1)%n]);
					Point q;
					if(intersect(s,t,&q)){
						if(abs(q-p)>EPS && abs(g[i]-q)>EPS){
							if(!contain(g,q-1e-5*u) || !contain(g,q+1e-5*u)){
								b=false;
								break;
							}
						}
					}
				}
				if(!b)	break;
			}
			if(b)	goto FOUND;
		}
		goto NOT_FOUND;

		FOUND:
		puts("1");
		continue;

		NOT_FOUND:
		puts("0");
	}

	return 0;
}

Measured memory_bytes: 828