// Arup Guha
// 3/5/2021
// Solution to 2021 February USACO Bronze Problem: Comfortable Cows

import java.util.*;
import java.io.*;

public class comfortable {

	// Direction to look for neighbors.
	final public static int[] DX = {-1,0,0,1};
	final public static int[] DY = {0,-1,1,0};

	public static void main(String[] args) throws Exception {
	
		// Pad on left and right by 1 space. -1 means no cow.
		int[][] neighbors = new int[1003][1003];
		for (int i=0; i<=1000; i++)
			Arrays.fill(neighbors[i], -1);
		
		int res = 0;
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(stdin.readLine().trim());
		
		// Store the answer.
		StringBuffer sb = new StringBuffer();
		
		// Process adding each point.
		for (int loop=0; loop<n; loop++) {
		
			StringTokenizer tok = new StringTokenizer(stdin.readLine());
			
			// Get the point.
			int x = Integer.parseInt(tok.nextToken())+1;
			int y = Integer.parseInt(tok.nextToken())+1;
			
			// At first I have no neighbors.
			neighbors[x][y] = 0;
			int tmp = 0;
			
			// Look at my adjacent locations.
			for (int i=0; i<DX.length; i++) {
				
				// There is a cow adjacent to me in direction i.
				if (neighbors[x+DX[i]][y+DY[i]] >= 0) {
					
					// Update my count and the neighbor's count.
					tmp++;
					neighbors[x+DX[i]][y+DY[i]]++;
					
					// Update our running tally.
					if (neighbors[x+DX[i]][y+DY[i]] == 3) res++;
					if (neighbors[x+DX[i]][y+DY[i]] > 3) res--;
				}
			}
			
			// Update my tally and if necessary the result, then append to the whole result.
			neighbors[x][y] = tmp;
			if (neighbors[x][y] == 3) res++;
			sb.append(res+"\n");
		}
		
		// Ta da!
		System.out.print(sb);
	}
}
