#include #include #define N 100000 typedef struct zlom { int x,y; } zlom; zlom p[N]; int n; int sum; int cmp1(const void *a, const void *b) { zlom *va=(zlom *) a; zlom *vb=(zlom *) b; if (va->x > vb->x) return 1; if (va->x < vb->x) return -1; if (va->y > vb->y) return 1; if (va->y < vb->y) return -1; return 0; } int cmp2(const void *a, const void *b) { const zlom *va=(const zlom *) a; const zlom *vb=(const zlom *) b; if (va->y > vb->y) return 1; if (va->y < vb->y) return -1; if (va->x > vb->x) return 1; if (va->x < vb->x) return -1; return 0; } int main() { int i; while (1) { scanf("%d", &n); if (n == 0) break; for ( i=0; i