#include<bits/stdc++.h>
using namespace std;
#define maxP 100005
#define FOR(a,b,c) for(a=b;a<c;a++)
#define REMOVE_REDUNDANT
#define EPS 1e-9
#define PI acos(-1.0)
typedef struct {
    double x, y;
} Point;
Point P[maxP], CH[maxP],pivot;
int cmp(const void *i, const void *j) {
    Point *a, *b;
    a = (Point *)i, b = (Point *)j;
    if(a->y != b->y)
        return a->y - b->y > 0 ? 1 : -1;
    return a->x - b->x > 0 ? 1 : -1;
}
bool myComparison(const Point &a,const Point &b)
{
	if(a.y!=b.y)
       return a.y<b.y;
    else return a.x<b.x;
}
double cross(Point *o, Point *a, Point *b) {  		// cross product
    return (a->x - o->x)*(b->y - o->y) -
        (a->y - o->y)*(b->x - o->x);
}

double dist(Point p1, Point p2) {                // Euclidean distance
  return hypot(p1.x - p2.x, p1.y - p2.y); }           // return double

bool angleCmp(Point &a, Point &b) {                 // angle-sorting function
  if (fabs(cross(&pivot, &a, &b)) < EPS)                               // special case
    return dist(pivot, a) < dist(pivot, b);    // check which one is closer
  double d1x = a.x - pivot.x, d1y = a.y - pivot.y;
  double d2x = b.x - pivot.x, d2y = b.y - pivot.y;
  return (atan2(d1y, d1x) - atan2(d2y, d2x)) < 0; }   // compare two angles

void convexHull(int n) {
    int P0 = 0;
  for (int i = 1; i < n; i++)
  if (P[i].y < P[P0].y || (P[i].y == P[P0].y && P[i].x < P[P0].x)) //Diurutkan dari y terkecil, jika y sama maka diutamakan x yang paling kecil.
      {P0 = i;}
  Point temp; 
  temp = P[0]; 
  P[0] = P[P0]; 
  P[P0] = temp;  //swap pivot
  pivot=P[0];
  sort(P+1,P+n,angleCmp); // sort berdasarkan angle
  int i, m = 0, t;
    for(i = 0; i < n; i++) {
        while(m >= 2 && cross(&CH[m-2], &CH[m-1], &P[i]) < 0) // mengecek apakah belok ke kanan atau ke kiri. jika collinear tidak dimasukkan, ditambahkan = . Hati-hati dengan redundant karena tanpa =  akan menambahkan redundant
            m--;
        CH[m++] = P[i];
    }
    for(i = n-2, t = m+1; i >= 0; i--) {		
        while(m >= t && cross(&CH[m-2], &CH[m-1], &P[i]) < 0) // mengikuti aturan diatas
            m--;
        CH[m++] = P[i];
    }
    printf("%d\n",m-1);
    for(i = 0; i < m-1; i++) {
       
        printf("%.lf %.lf\n", CH[i].x, CH[i].y);
    }
}int main()
{	
	int t,tc,i,n;
	double x,y;
	int k;
	Point contoh;
	char dummy[5];
	tc=1;
	FOR(t,0,tc)
	{
		scanf("%d",&n);
		k=0;
		FOR(i,0,n)
		{
			scanf("%lf %lf",&contoh.x,&contoh.y);
			
				P[k]=contoh;
				k+=1;
			
		}
		convexHull(k);
	}
}