LearnPy Hub
← Arena
AdvancedRating 1800

Grid Points Inside a Polygon

A simple polygon has corners at integer points (given in order). Count the integer points strictly inside it. Use Pick's theorem.

Input

n, then n lines 'x y'.

Output

One integer.

Sample 1

Input
4
0 0
4 0
4 4
0 4
Output
9

Sample 2

Input
3
0 0
2 0
0 2
Output
0
solution.py
Output appears here
Grid Points Inside a Polygon · Python Arena problem · LearnPy Hub