#include <bits/stdc++.h>
inline long long crs(const std::complex<long long> &a,
                     const std::complex<long long> &b) {
  return (conj(a) * b).imag();
}
std::complex<long long> arr[1005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    arr[i] = std::complex<long long>(x, y);
  };
  if (arr[2].imag() > arr[0].imag()) {
    for (int i = 0; i < n; i++) arr[i] = -arr[i];
  }
  int l = 1e9, r = -1e9, idx = n - 1;
  for (int i = arr[0].real(); i <= arr[1].real(); i++) {
    std::complex<long long> p(i, arr[0].imag());
    while (idx > 1 && crs(arr[idx] - p, arr[idx - 1] - p) >= 0) idx--;
    if (idx <= 1) {
      l = i;
      break;
    }
  }
  idx = 1;
  for (int i = arr[1].real(); i >= arr[0].real(); i--) {
    std::complex<long long> p(i, arr[0].imag());
    while (idx < n - 1 && crs(arr[idx + 1] - p, arr[idx] - p) >= 0) idx++;
    if (idx >= n - 1) {
      r = i;
      break;
    }
  }
  printf("%d\n", std::max(r - l + 1, 0));
  return 0;
}
