#include<cmath>
#include<cstdio>
#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;

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

enum {CCW=1,CW=-1,ON=0};
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 cover(const Segment &s,const Point &p){
	return dot(s[0]-p,s[1]-p)<EPS;
}

bool intersect(const Line &l,const Line &m,Point &p){
	if(abs(cross(l[1]-l[0],m[1]-m[0]))>EPS
	|| abs(cross(l[1]-l[0],m[0]-l[0]))<EPS){
		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){
	bool flg;
	if(abs(cross(s[1]-s[0],t[1]-t[0]))<EPS && abs(cross(s[1]-s[0],t[0]-s[0]))<EPS){
		flg=(cover(s,t[0]) || cover(s,t[1]) || cover(t,s[0]) || cover(t,s[1]));
		if(!flg) return false;
	}

	if(flg || (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)){
		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(cover(s,q[i]) && cover(t,q[i])){
					p=q[i];
					break;
				}
			}
		}
		else p=Point(b1*c2-b2*c1,a2*c1-a1*c2)/det;
		return true;
	}
	return false;
}

bool cover(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;
}

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(!cover(g,p+1e-5*u) || !cover(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(p-q)>EPS && abs(g[i]-q)>EPS){
					if(!cover(g,q-1e-5*u) || !cover(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) && cover(g,p)){
				if(isViewableAllVertices(g,p)){ b=true; goto FOUND; }
			}
		}

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

	return 0;
}

Measured memory_bytes: 800