#include #include #include #define INF 1000000010 #define MOD 1000000007 using namespace std; FILE * input = fopen("countm.in","r"); FILE * output = fopen("countm.out","w"); struct point{ int x,y; point(){}; point(int _x, int _y){ x = _x; y = _y; }; void print(){ printf("%d %d\n",x,y); } }; bool comparePoints (point a, point b) { return (a.x == b.x) ? (a.y < b.y) : (a.x < b.x); } int N; vector points; point combination[10]; int cnt = 0; void solve(int depth, int lastP){ //printf("%d\n", depth); if (depth == 5){ //for(int i = 0;i<5;i++) // printf("%d %d | ", combination[i].x,combination[i].y); //printf("\n"); cnt = (cnt + 1) % MOD; return; } for(int i = lastP+1;i < N;i++){ if(depth == 0){ combination[depth] = points[i]; solve(depth+1,i); continue; } if ( combination[depth-1].x == points[i].x ) continue; if( depth == 1 && combination[0].y <= points[i].y){ combination[depth] = points[i]; solve(depth+1,i); }else if (depth == 2 && combination[1].y >= points[i].y ){ combination[depth] = points[i]; solve(depth+1,i); }else if (depth == 3 && combination[2].y <= points[i].y ){ combination[depth] = points[i]; solve(depth+1,i); }else if (depth == 4 && combination[3].y >= points[i].y ){ combination[depth] = points[i]; solve(depth+1,i); } //printf("%d ", i); } } int main(){ fscanf( input, "%d",&N); int x,y; for (int i=0; i < N ;i++){ fscanf(input, "%d %d", &x, &y); points.push_back( point(x,y) ); } sort( points.begin(), points.end(), comparePoints ); //for(int i=0; i < N ;i++) points[i].print(); solve(0,-1); fprintf(output,"%d\n",cnt); return 0; }