#include <bits/stdc++.h>
using namespace std;
struct point {
  double x, y;
};
struct sline {
  double a, b, c;
};
point ps[1010], ps2[1010];
int pc, pc2;
sline ss[1010];
const double E = 1e-12;
inline void format(sline &s, point &p1, point &p2) {
  s.a = p2.y - p1.y;
  s.b = p1.x - p2.x;
  s.c = -s.a * p1.x - s.b * p1.y;
}
inline int dblcmp(double x) {
  if (x > -E && x < E) return 0;
  return x > 0 ? 1 : -1;
}
inline point gcross(sline &s, point &p1, point &p2) {
  double u = fabs(s.a * p1.x + s.b * p1.y + s.c);
  double v = fabs(s.a * p2.x + s.b * p2.y + s.c);
  point p;
  p.x = (v * p1.x + u * p2.x) / (u + v);
  p.y = (v * p1.y + u * p2.y) / (u + v);
  return p;
}
void cut(sline &s) {
  pc2 = 0;
  for (int i = 1; i <= pc; i++) {
    if (dblcmp(s.a * ps[i].x + s.b * ps[i].y + s.c) >= 0) {
      ps2[++pc2] = ps[i];
    } else {
      if (dblcmp(s.a * ps[i - 1].x + s.b * ps[i - 1].y + s.c) > 0) {
        ps2[++pc2] = gcross(s, ps[i - 1], ps[i]);
      }
      if (dblcmp(s.a * ps[i + 1].x + s.b * ps[i + 1].y + s.c) > 0) {
        ps2[++pc2] = gcross(s, ps[i + 1], ps[i]);
      }
    }
  }
  pc = pc2;
  for (int i = 1; i <= pc; i++) {
    ps[i] = ps2[i];
  }
  ps[0] = ps[pc];
  ps[pc + 1] = ps[1];
}
bool cmp(const point &p1, const point &p2) {
  if (dblcmp(p1.x - p2.x) == 0) return p1.y < p2.y;
  return p1.x < p2.x;
}
bool uncmp(const point &p1, const point &p2) {
  if (dblcmp(p1.x - p2.x) == 0 && dblcmp(p1.y - p2.y) == 0) return true;
  return false;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &ps[i].x, &ps[i].y);
  }
  ps[0] = ps[n];
  ps[n + 1] = ps[1];
  for (int i = 2; i <= n; i++) {
    format(ss[i - 1], ps[i], ps[i + 1]);
  }
  ps[0] = ps[2];
  ps[3] = ps[1];
  pc = 2;
  for (int i = 1; i <= n - 1; i++) {
    cut(ss[i]);
  }
  for (int i = 0; i < pc; i++) {
    ps[i] = ps[i + 1];
  }
  sort(ps, ps + pc, cmp);
  pc = unique(ps, ps + pc, uncmp) - ps;
  if (pc == 0) {
    printf("0\n");
  } else {
    int h = (int)floor(ps[1 % pc].x + E);
    int l = (int)ceil(ps[0].x - E);
    printf("%d\n", h - l + 1);
  }
  return 0;
}
