#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using Int = long long; template ostream &operator<<(ostream &os, const pair &a) { return os << "(" << a.first << ", " << a.second << ")"; }; template ostream &operator<<(ostream &os, const vector &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; } template void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; } template bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; } template bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; } #define COLOR(s) ("\x1b[" s "m") inline int sig(Int r) { return (r < 0) ? -1 : (r > 0) ? +1 : 0; } inline Int sq(Int r) { return r * r; } struct Pt { Int x, y; Pt() : x(0), y(0) {} Pt(Int x_, Int y_) : x(x_), y(y_) {} Pt operator+(const Pt &a) const { return Pt(x + a.x, y + a.y); } Pt operator-(const Pt &a) const { return Pt(x - a.x, y - a.y); } Pt operator*(const Pt &a) const { return Pt(x * a.x - y * a.y, x * a.y + y * a.x); } Pt operator+() const { return Pt(+x, +y); } Pt operator-() const { return Pt(-x, -y); } Pt operator*(const Int &k) const { return Pt(x * k, y * k); } Pt operator/(const Int &k) const { return Pt(x / k, y / k); } friend Pt operator*(const Int &k, const Pt &a) { return Pt(k * a.x, k * a.y); } Pt &operator+=(const Pt &a) { x += a.x; y += a.y; return *this; } Pt &operator-=(const Pt &a) { x -= a.x; y -= a.y; return *this; } Pt &operator*=(const Pt &a) { return *this = *this * a; } Pt &operator*=(const Int &k) { x *= k; y *= k; return *this; } Pt &operator/=(const Int &k) { x /= k; y /= k; return *this; } Int abs2() const { return x * x + y * y; } Int dot(const Pt &a) const { return x * a.x + y * a.y; } Int det(const Pt &a) const { return x * a.y - y * a.x; } bool operator==(const Pt &a) const { return (x == a.x && y == a.y); } bool operator!=(const Pt &a) const { return !(x == a.x && y == a.y); } bool operator<(const Pt &a) const { return ((x != a.x) ? (x < a.x) : (y < a.y)); } friend ostream &operator<<(ostream &os, const Pt &a) { os << "(" << a.x << ", " << a.y << ")"; return os; } }; inline Int tri(const Pt &a, const Pt &b, const Pt &c) { return (b - a).det(c - a); } bool iSSStrict(const Pt &a, const Pt &b, const Pt &c, const Pt &d) { return (sig(tri(a, b, c)) * sig(tri(a, b, d)) < 0 && sig(tri(c, d, a)) * sig(tri(c, d, b)) < 0); } bool check(const Pt &a, const Pt &b, const Pt &c) { int s = sig((b - a).det(c - a)); if (s != 0) return false; if (sig((b - a).dot(c - a)) <= 0) return false; // c-a-b if (sig((a - b).dot(c - b)) <= 0) return false; // a-b-c return true; } int N; vector P; int mod(int u) { return ((u %= N) < 0) ? (u + N) : u; } int solve() { for (int u = 0; u < N; ++u) for (int v = u + 1; v < N; ++v) { const Pt a = P[u], b = P[mod(u + 1)]; const Pt c = P[v], d = P[mod(v + 1)]; if (check(a, b, c)) return 0; if (check(a, b, d)) return 0; if (check(c, d, a)) return 0; if (check(c, d, b)) return 0; if (iSSStrict(a, b, c, d)) return 0; } for (int u = 0; u < N; ++u) { if (tri(P[u], P[mod(u + 1)], P[mod(u + 2)]) == 0) return 0; } __int128 area = 0; for (int u = 0; u < N; ++u) area += P[u].det(P[mod(u + 1)]); if (area < 0) reverse(P.begin(), P.end()); for (int u = 0; u < N; ++u) { bool ok = true; for (int i = 1; i <= N - 2; ++i) { const int v = mod(u + i); const int w = mod(u + i + 1); ok = ok && (tri(P[u], P[v], P[w]) >= 0); } if (ok) return 1; } return -1; } int main() { for (; ~scanf("%d", &N); ) { P.resize(N); for (int u = 0; u < N; ++u) { scanf("%lld%lld", &P[u].x, &P[u].y); } const int ans = solve(); printf("%d\n", ans); } return 0; }