AtCoder Grand Contest 051 (Good Bye rng_58 Day 2)
C
Flipper
AtCoder
⌀ 2928
原题
← BD →
翻译中…

Problem Statement

翻译中…

There is a square grid of dimensions $10^9 \times 10^9$. The cells are numbered $(1, 1)$ through $(10^9, 10^9)$. Cell $(i, j)$ is in the $i$-th row from the top, and the $j$-th column from the left. Initially, $N$ cells $(x_1, y_1), \ldots, (x_N, y_N)$ are black, and all other cells are white.

翻译中…

Snuke can perform the following operation an arbitrary number of times:

翻译中…
  • Choose an integer $x (1 \leq x \leq 10^9 - 1)$ and an integer $y (1 \leq y \leq 10^9 - 2)$, and flip (black to white, white to black) the colors of the following six cells: $(x, y), (x, y+1), (x, y+2), (x+1, y), (x+1, y+1), (x+1, y+2)$
翻译中…

Compute the minimum possible number of black cells after the operations.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^5$
  • $1 \leq x_i, y_i \leq 10^9$
  • $(x_i, y_i)$ are pairwise distinct.
  • All values in the input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
x_1 \ y_1
:
x_N \ y_N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
9
1 2
1 3
2 1
2 3
2 4
3 2
3 3
3 4
4 2
Output #1
3
In the diagram below, the $j$-th letter of the $i$-th string from the top represents the cell $(i, j)$. `#` is black, `.` is white.
题目信息
题号
agc051_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。