There are N points on an infinite two-dimensional plane. The points are numbered 0 through N-1, and point i lies at (xi,yi). No two points share an x coordinate, and no two points share a y coordinate.
Pick three of the points and color one red, one green, and one blue. Let r be the number of the red point, g the number of the green point, and b the number of the blue point. The coloring must satisfy xr<xg<xb and yr<yb<yg at the same time.
Given the coordinates of the points, write a program that counts the colorings satisfying both conditions.