#include <bits/stdc++.h>
using namespace std;
int cmp(long double first, long double second = 0, long double tol = 1e-9) {
  return (first <= second + tol) ? (first + tol < second) ? -1 : 0 : 1;
}
struct point {
  long double first, second;
  point() : first(0), second(0) {}
  point(long double X, long double Y) : first(X), second(Y) {}
  int cmp(point a) {
    if (::cmp(first, a.first)) return ::cmp(first, a.first);
    return ::cmp(second, a.second);
  }
  point operator+(point a) { return point(first + a.first, second + a.second); }
  point operator-(point a) { return point(first - a.first, second - a.second); }
  point operator*(long double a) { return point(first * a, second * a); }
  point operator/(long double a) { return point(first / a, second / a); }
  long double operator*(point a) { return first * a.first + second * a.second; }
  long double operator%(point a) { return first * a.second - second * a.first; }
  bool operator<(point a) { return cmp(a) == -1; }
  bool operator==(point a) { return cmp(a) == 0; }
  bool operator!=(point a) { return cmp(a) != 0; }
  bool operator<=(point a) { return cmp(a) <= 0; }
  point operator[](long double a) {
    return point(cos(a) * first - sin(a) * second,
                 sin(a) * first + cos(a) * second);
  }
};
long double abs(point a) { return sqrt(a * a); }
long double dist(point a, point b) { return abs(a - b); }
int ccw(point a, point b, point c) { return cmp((b - a) % (c - a)); }
bool between(point a, point b, point c) {
  return ccw(a, b, c) == 0 && cmp((a - b) * (c - b)) <= 0;
}
long double angle(point u, point v) { return atan2(u % v, u * v); }
int main() {
  int n, Y, l, r;
  point ult, cur;
  scanf("%d", &n);
  for (int(i) = (0); (i) < (n); (i)++) {
    int first, second;
    scanf("%d%d", &first, &second);
    cur.first = first, cur.second = second;
    if (i < 2) {
      Y = second;
      if (!i)
        l = first;
      else
        r = first;
      if (i && l > r) swap(l, r);
    } else {
      while (l <= r && ccw(ult, cur, point(l, Y)) == 1) l++;
      while (r >= l && ccw(ult, cur, point(r, Y)) == 1) r--;
    }
    ult = cur;
  }
  printf("%d\n", r - l + 1);
}
