Comfortable Cows (Bronze)#11208

Comfortable Cows (Bronze)

1 second
128 megabytes
Easy

Farmer John's pasture can be regarded as a large 2D grid of square "cells" (picture a huge chessboard). Initially, the pasture is empty.

Farmer John will add cows to the pasture one by one. The -th cow will occupy a cell (x_i, y_i) that is distinct from the cells occupied by all other cows.

A cow is said to be "comfortable" if it is horizontally or vertically adjacent to exactly three other cows. Farmer John is interested in counting the comfortable cows on his farm. For each in the range from to , output the total number of comfortable cows after the -th cow is added to the pasture.

Input

The first line contains a single integer (1 \leq n \leq 10^5). Each of the next lines contains two integers, indicating the (0 \leq x, y \leq 1000) coordinates of a cow's cell. It is guaranteed that all these cells are distinct.

Output

The -th line of output should contain the total number of comfortable cows after the first cows are added to the pasture.

Examples

Example 1

Loading
Loading

Note

After the first four cows are added, the cow at is comfortable.

After the first seven cows are added, the cow at is comfortable.

After the first eight cows are added, the cows at and are comfortable.