#include <bits/stdc++.h>
using namespace std;
struct node {
  double x, y;
};
const int maxn = 1010;
int n;
node v[maxn], t[maxn];
int cmp(double x) {
  if (fabs(x) <= 1e-8) return 0;
  if (x > 1e-8) return 1;
  return -1;
}
double det(node a, node b, node c) {
  return (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y);
}
double dot(node a, node b, node c) {
  return (b.x - a.x) * (c.x - a.x) + (b.y - a.y) * (c.y - a.y);
}
void get(node m1, node m2, double &a1, double &b1, double &c1) {
  a1 = m1.y - m2.y;
  b1 = m2.x - m1.x;
  c1 = m1.x * m2.y - m2.x * m1.y;
}
node getcross(double a1, double b1, double c1, double a2, double b2,
              double c2) {
  node ans;
  ans.x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
  ans.y = (a1 * c2 - a2 * c1) / (b1 * a2 - b2 * a1);
  return ans;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> v[i].x >> v[i].y;
  if (v[1].x > v[2].x) {
    for (int i = 1; i <= n; i++) t[i] = v[i], t[i].y *= -1;
    v[1] = t[2];
    v[2] = t[1];
    for (int i = n, cur = 3; i >= 3; i--, cur++) v[cur] = t[i];
  }
  double L = v[1].x, R = v[2].x;
  L = v[1].x, R = v[2].x;
  for (int i = 4; i <= n; i++)
    if (cmp(det(v[2], v[1], v[i])) * cmp(det(v[2], v[i - 1], v[i])) > 0) {
      R--;
      break;
    }
  for (int i = n - 1; i >= 3; i--)
    if (cmp(det(v[1], v[2], v[i])) * cmp(det(v[1], v[i + 1], v[i])) > 0) {
      L++;
      break;
    }
  for (int i = 3; i <= n; i++) {
    for (int j = 3; j < i; j++) {
      if (cmp(v[j].y - v[i].y) <= 0) continue;
      double a1, b1, c1, a2, b2, c2;
      get(v[i], v[j], a1, b1, c1);
      get(v[1], v[2], a2, b2, c2);
      node cross = getcross(a1, b1, c1, a2, b2, c2);
      R = min(R, cross.x);
    }
    for (int j = i + 1; j <= n; j++) {
      if (cmp(v[j].y - v[i].y) <= 0) continue;
      double a1, b1, c1, a2, b2, c2;
      get(v[i], v[j], a1, b1, c1);
      get(v[1], v[2], a2, b2, c2);
      if (!cmp(v[i].y - v[j].y)) continue;
      node cross = getcross(a1, b1, c1, a2, b2, c2);
      L = max(L, cross.x);
    }
  }
  int ans = 0;
  for (int i = 0; i <= 1000000; i++)
    if (cmp((double)i - L) >= 0 && cmp((double)i - R) <= 0) ans++;
  cout << ans << endl;
  return 0;
}
