#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
constexpr ll inf = 4e18;
mt19937 mt(time(0));
typedef complex<ll> point;
#define X real()
#define Y imag()
ll cross(point a, point b) {
return a.X * b.Y - a.Y * b.X;
}
void solve() {
ll n; cin >> n;
vector<point> pts(n - 1);
ll ox, oy; cin >> ox >> oy;
for (auto &p : pts) {
ll x, y; cin >> x >> y;
p = point(x - ox, y - oy);
}
ll res = 0;
for (ll i = 1; i < sz(pts); i++) {
res = gcd(res, cross(pts[0], pts[i]));
}
cout << res - !res << '\n';
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
solve();
}