Can you suggest me a solution for the problem sgu 369?
Vasya loves his new game which is played on an infinite rectangular grid where K cells are initially black, all other cells are white. The move of the game is to find three black cells which are vertices of some rectangle with sides parallel to coordinate axis such that the fourth vertex of the rectangle is white. In this case you need to paint the fourth vertex black. Vasya asks you to write a program which calculates the number of black cells in the end of the game, i.e. when no more moves can be made.
(0 ≤ K≤ 2· 10^5) and -10^9 ≤ Xi, Yi ≤ 10^9