#include <bits/stdc++.h>
#define nmax 100010 
#define eps 1e-9
#define f(c,a,b) for (int c=a; c<=b; c++)

using namespace std;
typedef double db;
struct P{
    db x, y;
    P(){};
    db times(P a) { return x*a.y-y*a.x; }
    P (db _x, db _y):x(_x),y(_y){}
    bool operator < (const P a) const { return (a.y==y)?a.x>x:a.y>y; }
    P operator - (const P a) const { return P(a.x-x,a.y-y); }
    db len(){ return sqrt(x*x + y*y); }
};
typedef P V;
P ps[nmax],po[nmax];
int is=0, n;

int sign(db x) { return x<-eps?-1:x>eps; }

void andrew(){
    ps[++is]=po[1];
    f(i,2,n){
        while( is>=2 && (ps[is]-ps[is-1]).times(po[i]-ps[is])<0 ) is--;
        ps[++is]=po[i];
    }
    for(int i=n-1; i>=1; i--){
        while( is>=2 && (ps[is]-ps[is-1]).times(po[i]-ps[is])<0 ) is--;
        ps[++is]=po[i];
    }
}

int main(){
    //freopen("owo.in","r",stdin);
    cin >> n;
    f(i,1,n) scanf("%lf%lf", &po[i].x, &po[i].y);
    sort(po+1,po+1+n);
    andrew();
    cout << (is-1) << endl;
    f(i,1,is-1) printf("%d %d\n", (int)ps[i].x, (int)ps[i].y);
    return 0;
}
