#include <algorithm>
#include <numeric>
#include <map>
#include <vector>
#include <cmath>
#include <iostream>
#include <complex>
#include <queue>
#include <cassert>

using namespace std;

#define ALL(c) (c).begin(),(c).end()
#define FOR(i,l,r) for(int i=(int)l;i<(int)r;++i)
#define REP(i,n) FOR(i,0,n)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

template<typename T,typename U> T pmod(T x,U M){return (x%M+M)%M;}

typedef long long ll;
typedef ll Cost;Cost CINF=1LL<<58;
struct Edge{
  int f,t;Cost c;
  Edge(int f,int t,Cost c):f(f),t(t),c(c){};
  bool operator <(Edge r)const {return c<r.c;}
  bool operator >(Edge r)const {return c>r.c;}
};
typedef vector<vector<Edge> > Graph;

struct Task{
  int prev,pos;Cost c;
  Task(int prev,int pos,Cost c):prev(prev),pos(pos),c(c){};
  bool operator >(const Task& r) const{return c >r.c;}
};

typedef long double D;
const D INF = 1e12,EPS = 1e-8;

int sig(D a,D b=0){return a<b-EPS?-1:a>b+EPS?1:0;}
bool eq(D a,D b){ return sig(abs(a-b))==0;}
D norm(D a){ return a*a;}

typedef complex<D> P;
#define X real()
#define Y imag()

bool eq(const P& a,const P& b){ return sig(abs(a-b))==0;}
bool compX (const P& a,const P& b){return a.X != b.X ? a.X < b.X : a.Y < b.Y;}

istream& operator >> (istream& is,complex<D>& p){
    D x,y;is >> x >> y;p=P(x,y);return is;
}

// a×b
D cross(const P& a,const P& b){return imag(conj(a)*b);}
// a・b
D dot(const P& a,const P& b) {return real(conj(a)*b);}

int ccw(const P& a,P b,P c){
  b -= a; c -= a;
  if (cross(b,c) > 0)   return +1;       // counter clockwise
  if (cross(b,c) < 0)   return -1;       // clockwise
  if (dot(b,c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0; //a--c--b on line (or b==c)
}

namespace std{
	bool operator <  (const P& a,const P& b){return compX(a,b);}
  	bool operator == (const P& a,const P& b){return eq(a,b);}
};

typedef vector<P> Poly,ConvexPoly;

enum { OUT, ON, IN };
int contains(const Poly& ps, const P& p) {
  bool in = false;int n=ps.size();
  	REP(i,n){
		P a = ps[i] - p, b = ps[pmod(i+1,n)] - p;
		if (a.Y > b.Y) swap(a, b);
		if (a.Y <= 0 && 0 < b.Y)
 		if (cross(a, b) < 0) in = !in;
    		if (cross(a, b) == 0 && dot(a, b) <= 0) return ON;
  	}
	return in ? IN : OUT;
}
D area2(const Poly& ps){
  D S=0;int n=ps.size();
  REP(i,n)S+=cross(ps[i],ps[pmod(i+1,n)]);
  return S;
}

bool intersect_1pt(const P& a, const P& b,
                   const P& c, const P& d,P &r) {
  // cerr << a <<" " << b << " " << c << " " <<d <<endl;
  D cr =  cross(b - a, d - c);
  // cerr << cr <<endl;
  if (sig(cr)==0) return false;

  D t =  cross(c - a, d - c) / cr;
  D s = -cross(a - c, b - a) / cr;
  r = a + t * (b - a); //cerr <<"r"<< r <<endl;
  return sig(t,0)>=0 && sig(t,1)<=0 && sig(s,0)>=0 && sig(s,1)<=0;
}

ConvexPoly convex_intersect(const ConvexPoly &ps, const ConvexPoly &qs) {
  const int n = ps.size(), m = qs.size();
  int a = 0, b = 0, aa = 0, ba = 0;
  enum { Pin, Qin, Unknown } in = Unknown;
  ConvexPoly rs;
  do {
    int a1 = (a+n-1) % n, b1 = (b+m-1) % m;
    D C = cross(ps[a] - ps[a1], qs[b] - qs[b1]);
    D A = cross(ps[a1] - qs[b], ps[a] - qs[b]);
    D B = cross(qs[b1] - ps[a], qs[b] - ps[a]);
    P r;
    if (intersect_1pt(ps[a1], ps[a], qs[b1], qs[b], r)) {
      if (in == Unknown) aa = ba = 0;
      rs.push_back( r );
      in = B > 0 ? Pin : A > 0 ? Qin : in;
    }
    if (C == 0 && B == 0 && A == 0) {
      if (in == Pin) { b = (b + 1) % m; ++ba; }
      else           { a = (a + 1) % m; ++aa; }
    } else if (C >= 0) {
      if (A > 0) { if (in == Pin) rs.push_back(ps[a]); a = (a+1)%n; ++aa; }
      else       { if (in == Qin) rs.push_back(qs[b]); b = (b+1)%m; ++ba; }
    } else {
      if (B > 0) { if (in == Qin) rs.push_back(qs[b]); b = (b+1)%m; ++ba; }
      else       { if (in == Pin) rs.push_back(ps[a]); a = (a+1)%n; ++aa; }
    }
	} while ( (aa < n || ba < m) && aa < 2*n && ba < 2*m );

  // cerr <<"i "<< in <<endl;
  if (in == Unknown) {
    if (contains(qs, ps[0])) return ps;
    if (contains(ps, qs[0])) return qs;
  }
  return rs;
}


struct L : public vector<P> {
    P vec;
    L(const P &a, const P &b):vec(b - a){
        push_back(a); push_back(b);
    }
};

P crosspoint(const L &l, const L &m) {
  D A = cross(l[1] - l[0], m[1] - m[0]);
  D B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}


// !CAUTION! number は有理数以上
ConvexPoly convex_cut(const ConvexPoly& ps, const L& l) {
  ConvexPoly qs;
  REP(i,ps.size()){
    P A = ps[i],B = ps[pmod(i+1,ps.size())];
    if(ccw(l[0], l[1], A) != -1) qs.push_back(A);
    if(ccw(l[0], l[1], A)*ccw(l[0], l[1], B) < 0)
      qs.push_back(crosspoint(L(A, B), l));
  }
  return qs;
}

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

  while(true){
  	int n;cin >> n;
  	if(n==0)break;
  	vector<P> ps(n);REP(i,n) cin >> ps[i];

  	vector<P> poly(4);
  	poly[0]=P(-10000,-10000);
  	poly[1]=P(10000,-10000);
  	poly[2]=P(10000,10000);
  	poly[3]=P(-10000,10000);

  	REP(i,n)if(poly.size()>0){
      // cerr << i <<endl;
  	  P p1=ps[i],p2=ps[pmod(i+1,n)],p3=ps[pmod(i+2,n)];
  	  if(ccw(p1,p2,p3)!=1 && ccw(p1,p2,p3)!=-2)continue;
      
      poly=convex_cut(poly,L(p1,p2));
      poly=convex_cut(poly,L(p2,p3));

     //  P p1e=p2+(p1-p2)*100000.0L,p3e=p2+(p3-p2)*100000.0L;
     //  P p4e=p2+(p1-p2)*100000.0L+(p3-p2)*100000.0L;
  	  // vector<P> qs(4);
     //  qs[0]=p1e;qs[1]=p2;qs[2]=p3e;qs[3]=p4e;

      // REP(i,poly.size()) cerr << poly[i] <<endl;
      // cerr << endl;
      // REP(i,qs.size()) cerr << qs[i] <<endl;
     //  cerr << endl;
  	  // poly=convex_intersect(poly,qs);

     //  REP(i,poly.size()) cerr << poly[i] <<endl;
     //  cerr <<endl;
  	}

    // REP(i,poly.size()) cerr << poly[i] <<endl;

  	if(abs(area2(poly)) > EPS) cout << 1 <<endl;
    else cout << 0 <<endl;


  }
}

Measured memory_bytes: 1276