#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
  point(int x = 0, int y = 0) : x(x), y(y) {}
};
point p[1005];
int n;
long long cp(point a, point b) {
  return (long long)a.x * b.y - (long long)a.y * b.x;
}
point operator-(point a, point b) { return point(a.x - b.x, a.y - b.y); }
int work() {
  int i;
  deque<point> q;
  for (i = min(p[1].x, p[2].x); i <= max(p[1].x, p[2].x); ++i)
    q.push_back(point(i, p[1].y));
  for (i = 2; i <= n; ++i) {
    while (!q.empty() && cp(p[i + 1] - p[i], q.front() - p[i]) > 0)
      q.pop_front();
    while (!q.empty() && cp(p[i + 1] - p[i], q.back() - p[i]) > 0) q.pop_back();
  }
  return q.size();
}
int main() {
  int i;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) scanf("%d%d", &p[i].x, &p[i].y);
  p[n + 1] = p[1];
  printf("%d\n", work());
  return 0;
}
