Fence

John Zynoulus has a garden full of blue-black flowers. They are arranged
in a square grid pattern.

However, Measharan scientists warn that there is a risk of a red rabbit
invasion. The rabbits like to eat blue-black flowers, so John needs to
put a fence to protect some of our flowers. For reasons of simplicity
and aesthetics, we have decided that our fence will have a polygonal
shape, and each of its vertices will be placed where a flower originally
was. For example, the fence below protects 7 blue-black flowers from red
rabbits.

[image]

John has designed the shape of the fence, but has some problems with
calculating the number of blue-black flowers inside it. Can you help
him?

Input

The first line contains the number of vertices N, 3 ≤ N ≤ 100000.

i-th of the following next N lines contains coordinates x_(i), y_(i) of
the i-th vertex of the polygon, where |x_(i)|,|y_(i)| ≤ 10000. Each pair
(x_(i), y_(i)) is distinct, and edges of our polygon don’t intersect
(except in vertices).

Output

Output the number of grid points inside the polygon.

Problem information

Author: Eryk Kopczynski

Generation: 2026-01-25T21:41:14.018Z

© Jutge.org, 2006–2026.
https://jutge.org
