#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
#include <stack>
using namespace std;

#define EPS (1e-10)
#define equals( A, B ) (fabs((A) - (B)) < EPS)

class Point {
public:
    double x, y;
    Point( double x = 0, double y = 0 ): x(x), y(y) {}
    
    Point operator + ( Point p ) { return Point( x + p.x, y + p.y ); }
    Point operator - ( Point p ) { return Point( x - p.x, y - p.y ); }
    Point operator * ( double a ) { return Point( a * x, a * y ); }
    Point operator / ( double a ) { return Point( x / a, y / a ); }

    double abs() { return sqrt( norm() ); }
    double norm() { return x * x + y * y; }

    bool operator < ( const Point &p ) const {
	return ( x != p.x ) ? x < p.x : y < p.y;
    }

    bool operator == ( const Point &p ) const {
	return equals( x, p.x ) && equals( y, p.y ); 
    }

    double dot( Point a ) { return x * a.x + y * a.y; }
    double cross( Point a ) { return x * a.y - y * a.x; }
    double distance( Point a ) {
	return (*this - a).abs();
    }
    double arg() {
	return atan2( y, x );
    }
};

typedef Point Vector;

typedef vector<Point> Polygon;

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

class Line {
public:
    Point p1, p2;
    Line( Point p1 = Point(), Point p2 = Point() ): p1(p1), p2(p2){}
    // ?????´????????????( cos = 0 )
    bool isOrthogonal( Line a ) {
	return equals( 0.0, (p1 - p2).dot( a.p1 - a.p2 ) );
    }
    // ??????????????????( sin = 0 )
    bool isParallel( Line a ) {
	return equals( 0.0, (p1 - p2).cross( a.p1 - a.p2 ) );
    }

    Point projection( Point p ) {
	Vector v12 = p2 - p1;
	double r = v12.dot( p - p1 ) / v12.norm();
	return p1 + v12 * r;
    }

    Point reflection( Point p ) {
	return p + ( projection( p ) - p ) * 2.0;
    }

    double distance( Point p ) {
	Vector v12 = this->p2 -this->p1;
	Vector v10 = p - this->p1;
	
	return abs( v12.cross( v10 ) / v12.abs() );
    }

    double distanceSP( Point p ) {
	if ( (p - this->p1).dot( this->p2 - this->p1 ) < 0.0 ) {
	    return this->p1.distance( p );
	} else if ( (p - this->p2).dot( this->p1 - this->p2 ) < 0.0 ) {
	    return this->p2.distance( p );
	}
	else {
	    return distance( p );
	}
    }

    int ccw( Point p ) {
	Vector a = p2 - p1;
	Vector b = p - p1;
	if ( a.cross( b ) > EPS ) return COUNTER_CLOCKWISE;
	else if ( a.cross( b ) < -EPS ) return CLOCKWISE;
	else if ( a.dot( b ) < -EPS ) return ONLINE_BACK;
	else if ( a.norm() < b.norm() ) return ONLINE_FRONT;
	else return ON_SEGMENT;
    }

    bool intersect( Line l ) {
	return ( ( ccw( l.p1 ) * ccw( l.p2 ) <= 0 && l.ccw( p1 ) * l.ccw( p2 ) <= 0 ) );
    }

    Point crossPoint( Line l ) {
	Vector base = p2 - p1;
	Vector v1 = l.p1 - p1;
	Vector v2 = l.p2 - p1;
	double d1 = base.cross( v1 );
	double d2 = base.cross( v2 );	
	double t = d1 / ( d1 + d2 );

	return l.p1 + ( l.p2 - l.p1 ) * t;
    }
};

typedef Line Segment;

int contains( Polygon poly, Point p ) {
    int n = poly.size();
    int count = 0;
    for ( int i = 0; i < n; i++ ) {
	Vector a = poly[i] - p;
	Vector b = poly[ ( i + 1 ) % n ] - p;

	// ???????????????
	if ( abs( a.cross( b ) ) < EPS && a.dot( b ) < EPS ) {
	    return 1;
	}
	// a.y???b.y??\?????????????????????
	if ( a.y > b.y ) {
	    Vector tmp = a; a = b; b = tmp;
	}
	// ??£?????????????????´????????????????????´???
	if ( a.y < EPS && b.y > EPS && a.cross( b ) > EPS ) {
	    count++;
	}
    }

    return ( count % 2 ) ? 2 : 0;
}

Polygon andrewScan( Polygon s ) {
    Polygon l, u;
    if ( s.size() < 3 ) return s; // 2?????\????????´???
    // x, y??§??????????????????
    sort(s.begin(), s.end());

    int n = s.size();
    u.push_back( s[0] );
    u.push_back( s[1] );
    l.push_back( s[n-1] );
    l.push_back( s[n-2] );

    // ???????????¨?????????
    for ( int i = 2; i < n; i++ ) {
	Point p = s[i];
	for ( int n = u.size(); ( n >= 2 && Line(u[n-2], u[n-1]).ccw( p ) == COUNTER_CLOCKWISE ); n-- ) {
	    u.pop_back();
	}
	u.push_back( p );
    }
    

    // ???????????¨?????????
    for ( int i = n - 3; i >= 0; i-- ) {
	Point p = s[i];
	for ( int n = l.size(); ( n >= 2 && Line(l[n-2], l[n-1]).ccw( p ) == COUNTER_CLOCKWISE ); n-- ) {
	    l.pop_back();
	}
	l.push_back( p );
    }

    // for ( int i = 0; i < l.size(); i++ ) {
    // 	printf("%lf %lf\n", l[i].x, l[i].y);
    // }

    
    reverse( l.begin(), l.end() );
    
    for ( int i = u.size() - 2; i >= 1; i-- ) l.push_back( u[i] );

    return l;
}


// bool compare( const Point &l, const Point &r ) {
//     return ( l.y != r.y ) ? (l.y < r.y) : (l.x < r.x);
// }

int main()
{
    int n;
    scanf("%d", &n);
    Polygon P;

    for ( int i = 0; i < n; i++ ) {
	Point p;

	scanf("%lf %lf", &p.x, &p.y);

	P.push_back( p );
    }

    // sort( P.begin(), P.end(), compare );

    Polygon conv = andrewScan( P );

    int min_y = 10050;
    int min_x = 10050;
    int index = -1;

    // ??????y????°??????????????????¢???
    for ( int i = 0; i < conv.size(); i++ ) {
	Point p = conv[i];
	if ( min_y == (int)p.y && min_x > (int)p.x ) {
	    min_y = (int)p.y;
	    min_x = (int)p.x;
	    index = i;
	}
	else if ( min_y > (int)p.y ) {
	    min_y = (int)p.y;
	    min_x = (int)p.x;
	    index = i;
	}
    }

    printf("%d\n", (int)conv.size());
    
    for ( int i = 0; i < conv.size(); i++ ) {
	printf("%d %d\n", (int)conv[(i + index) % conv.size()].x, (int)conv[(i + index) % conv.size()].y);
    }

    
    return 0;
}

Measured memory_bytes: 8520