Gardening

시간 제한1초메모리 제한2048 MB

문제

Bob has an incredibly huge garden with lots of grass and beautiful flowers, but since he started training his programming skills for the SKP, he does not have that much time to maintain it any more. To reduce the time spent maintaining his garden, Bob selected an area of his garden where he wants to place square stone tiles. He subdivided his garden into a $n$ by $n$ square grid $(1 \leq n \leq 1000)$ such that one stone tile fits exactly into one grid cell. Therefore, each tile must be placed inside exactly one grid cell.

The area Bob wants to fill with tiles is given as a sequence of $m$ points defining its perimeter. Each line segment between points $p_i$ and $p_{i+1}$ defines an edge of the area. Point $p_0$ is also connected to point $p_{m-1}$. In each cell within the defined perimeter, exactly one stone tile is placed. Bob now needs your help to count the number of stone tiles he needs to fill the entire designated area.

Figure 1 - Example testcase 2, where points given as input are highlighted.

입력

The first line of the input consists of one integer $m$ $(4 \leq m \leq 1000)$: the number of points that define the perimeter of the selected area.

The following input consists of $m$ distinct lines with two space-separated integers $x_i$ and $y_i$ $(1 \leq x_i,y_i \leq 1000)$: The coordinates of point $p_i$ are $(x_i,y_i)$. The bottom left corner is defined as point $(0,0)$ and the top right corner is defined as point $(n,n)$.

출력

One line with the number of square tiles required to fill the entire designated area.