#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)


#define EPS 1e-10
#define equal(a,b) (fabs(a-b) < EPS)

struct Point {
  double x, y;

  Point() : x(0), y(0){}
  Point(double x, double y) : x(x), y(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 * (const double &k)const{ return Point(x*k,y*k); }
  Point operator / (const double &k)const{ return Point(x/k,y/k); }
  bool operator < (const Point &p)const{ return x != p.x ? x < p.x : y < p.y; }
  bool operator == (Point &p)const
  {
    if (equal(x, p.x) && equal(y, p.y)) {
      return true;
    }
    return false;
  }
};


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


double norm(const Point &p)
{
  return dot(p,p);
}

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

double abs(const Point &p)
{
  return sqrt(norm(p));
}
#define COUNTER_CLOCKWISE +1
#define CLOCKWISE         -1
#define ONLINE_BACK       +2
#define ONLINE_FRONT      -2
#define ON_SEGMENT        +0
typedef Point Vector;

int ccw(const Point &p0, const Point &p1, const Point &p2)
{
  Vector a = p1 - p0;
  Vector b = p2 - p0;
  if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
  if (cross(a, b) < -EPS) return CLOCKWISE;
  if (dot(a, b) < -EPS) return ONLINE_BACK;
  if (norm(a) < norm(b)) return ONLINE_FRONT;
  return ON_SEGMENT;
}

struct Segment {
  Point s, t;
    
  Segment(){}
  Segment(Point s, Point t) : s(s), t(t) {}
  bool operator == (Segment &seg)const
  {
    if (s == seg.s && t == seg.t) {
      return true;
    }
    if (t == seg.s && s == seg.t) {
      return true;
    }
    return false;
  }
};

typedef Segment Line;
typedef Point Vector;
typedef vector<Point> Polygon;

Point crosspointLL(const Line &a, const Line &b)
{
  Vector va = a.t-a.s, vb = b.t-b.s;
  double d = cross(vb, va);
  if (abs(d) < EPS) return b.s;
  return a.s+va*cross(vb,b.t-a.s)*(1.0/d);
}


#define prev(G,i) (G[(i-1+G.size())%G.size()])
#define curr(G,i) (G[i%G.size()])
#define next(G,i) (G[(i+1)%G.size()])

Polygon convex_cut(Polygon pg, const Line &l)
{
  Polygon res;
  for (int i = 0; i < (int)pg.size(); i++) {
    Point cp = curr(pg,i), np = next(pg,i);
    if(ccw(l.s, l.t, cp) != -1) res.push_back(cp);
    if(ccw(l.s, l.t, cp)*ccw(l.s, l.t, np) < 0){
      res.push_back(crosspointLL(Line(cp, np), l));
    }
  }
  return res;
}


int containPP(const Polygon &pg, const Point &p)
{
  int N = pg.size();
  bool in = false;
  for (int i = 0; i < N; i++) {
    Point a = curr(pg, i)-p, b = next(pg, i)-p;
    if (a.y > b.y) swap(a, b);
    if (a.y <= 0 && 0 < b.y && cross(a, b) < 0) in = !in;
    if (cross(a, b) == 0 && dot(a, b) <= 0) return 1;
  }
  return (in ? 2 : 0); 
}

istream &operator >> (istream &is, Point &p)
{ 
  return is >> p.x >> p.y;
}

ostream &operator << (ostream &os, Point &p)
{ 
  return os << "(" << p.x << "," << p.y << ")";
}

typedef Point P;

int N;
Polygon g;
vector<int> vs;
/*
P make_judge_point(P const& s, P t, P r) {
  t = t - s, r = r - s;
  auto d = (t + r) / 2; d = d / abs(d);
  d = d * 5 * EPS;
  return s + d;
}

bool equals(P const& p, P const& q) {
  return equal(p.x, q.x) && equal(p.y, q.y);
}

bool samePP(Polygon const& g1, Polygon const& g2) {
  rep(i, g1.size()) {
    bool ok = 1;
    rep(j, g2.size()) {
      if(!equals(curr(g1, i + j), curr(g2, j))) {
	ok = 0;
	break;
      }
    }
    if(ok)
      return true;
  }
  rep(i, g1.size()) {
    bool ok = 1;
    rep(j, g2.size()) {
      if(!equals(curr(g1, i + j), curr(g2, 2*g2.size() - j))) {
	ok = 0;
	break;
      }
    }
    if(ok)
      return true;
  }
  return false;
}

bool solve() {
  
  bool first = false;
  Polygon cg;
  
  rep(i, vs.size()) {
    Polygon xg;
    xg.push_back(curr(g, vs[i]));
    xg.push_back(curr(g, vs[i]) + (next(g, vs[i]) - curr(g, vs[i]) * 1e5));
    xg.push_back(curr(g, vs[i]) + (prev(g, vs[i]) - curr(g, vs[i]) * 1e5));
    
    REP(j, i + 1, i + 1 + (int)vs.size()) {
      int nj = j % vs.size();
      auto Y0 = curr(g, vs[nj]);
      auto Y1 = next(g, vs[nj]);
      auto Y2 = prev(g, vs[nj]);
      auto L1 = Line(Y2, Y0);
      auto L2 = Line(Y0, Y1);
      xg = convex_cut(xg, L1);
      xg = convex_cut(xg, L2);
    }
    
    if(!first) cg = xg;
    else if(!samePP(cg, xg))
      return false;
  }
  
  return !cg.empty();
}

// ^ The code was written by chimpanzee.

*/

int main() {
  
  while(cin >> N && N) {
    g.clear(); g.resize(N);
    rep(i, N)
      cin >> g[i].x >> g[i].y;
    
    Polygon G = {P(), P(10000, 0), P(10000, 10000), P(0, 10000)};
    rep(i, N) {
      auto cutter = Line(g[i], g[(i+1) % N]);
      G = convex_cut(G, cutter);
    }
    cout << !G.empty() << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3168