#include "bits/stdc++.h"
using namespace std;

//?????????
#pragma region MACRO 
#define putans(x)  std::cerr << "answer: " ; cout << (x) << endl
#define dputans(x) std::cerr << "answer: "; cout << setprecision(13) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //???????????????????????????????????????????????????
std::ifstream ifs("data.txt");
#define put ifs >>
#else //?????£????????????????????§?????????????????????
#define put cin >>
#endif
#pragma endregion

//???????????°??????????????´
#pragma region CODING_SUPPORT
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#ifndef _DEBUG
#define dbg1 {}
#define dbg2 {}
#define dbg3 {}
#define dbgArray {}
#endif 
#pragma endregion 
//typedef????????????????????????????¶????????????§?????????
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//??????????????°(???????????????????????§??????)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(1e9)
#pragma endregion

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(x * a, y * a); }
	double operator * (Point p) { return dot(p); }
	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  fabs(x - p.x) < EPS && fabs(y - p.y) < EPS; }
	//???????????????
	double dot(Point p) { return x * p.x + y * p.y; }
	double cross(Point p) { return x * p.y - y * p.x; }


};
class Circle {
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0) :c(c), r(r) {}
};
struct Segment {//??????
	Point p1, p2;
};

typedef Point Vector;
typedef Segment Line;//??´???
typedef vector<Point> Polygon;

double v_norm(Point p) { return p.x * p.x + p.y * p.y; }
double abs(Point p) { return v_norm(p); }
double dot(Point p, Point q) { return p.x * q.x + p.y * q.y; }
double cross(Point p, Point q) { return p.x * q.y - p.y * q.x; }





//??´????????????
bool isOrthogonal(Vector a, Vector b) { return equals(a*b, 0.0); }
bool isParallel(Vector a, Vector b) { return equals(cross(a, b), 0.0); }

//??????s???????????????p????°???±
Point projection(Segment s, Point p) {
	Vector base = s.p2 - s.p1;
	double r = dot(( p - s.p1 ), base) / v_norm(base);
	return s.p1 + base*r;
}
//??????s???????????????p???????°?
Point reflection(Segment s, Point p) { return p + ( projection(s, p) - p ) * 2; }




//double getDistance(Point a, Point b) { return ( a - b ).abs; }
//double getDistanceLP(Line l, Point p) { return abs(cross(l.p2 - l.p1, p - l.p1) / abs(l.p2 - l.p1)); }
//double getDistanceSP(Segment s, Point p) {
//	if (dot(s.p2 - s.p1, p - s.p1) < 0.0) return abs(p - s.p1);
//	if (dot(s.p1 - s.p2, p - s.p2) < 0.0) return abs(p - s.p2);
//}

//double getDistance(Segment s1, Segment s2) {
//	if (intersect(s1, s2)) return 0;
//	return min(min(getDistanceSP(s1, s2.p1), getDistanceSP(s1, s2.p2))
//	         , min(getDistanceSP(s2, s1.p1), getDistanceSP(s2, s1.p2));
//}

//p1-p0???????????¨?????? p2-p0 ???2????????????????????????
static const int COUNTER_CLOCKWISE = 1;//???????¨???????
static const int CLOCKWISE = -1;//????¨???????
static const int ONLINE_BACK = 2;//????????´?????¶p2,p0,p1??????
static const int ONLINE_FRONT = -2;//????????´??????p0,p1,p2??????
static const int ON_SEGMENT = 0;//p2???p0,p1??????????????´???
int ccw(Point p0, Point p1, Point p2) {//????¨????????????¢??°
	Vector a = p1 - p0;
	Vector b = p2 - p0;
	if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
	if (cross(a, b) < -EPS) return CLOCKWISE;
	if (dot(a, b) < -EPS) return ONLINE_BACK;
	if (a.norm() < b.norm()) return ONLINE_FRONT;
	return ON_SEGMENT;
}
////??????p1p2??¨p3p4???????????????
//bool intersect(Point p1, Point p2, Point p3, Point p4) {return ( (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0) && (ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0));}
//bool intersect(Segment s1, Segment s2) {return intersect(s1.p1 , s1.p1, s2.p1, s2.p2);}
//
//Point getCrossPoint(Segment s1, Segment s2) {
//	Vector base = s2.p2 - s2.p1;
//	double d1 = abs(cross(base , s1.p1 - s2.p1));
//	double d2 = abs(cross(base , s1.p2 - s2.p1));
//	double t = d1 / ( d1 + d2 );
//	return s1.p1 + (s1.p2 - s1.p1 ) * t;
//}
//
////??´?????¨????????????????????????
//pair<Point, Point> getCrossPoints(Circle c, Line l) {
//	//assert(intersect(c, i)); ?????????????????´????????????????????????
//	Vector pr = projection(c, l);
//	Vector e = ( l.p2 - l.p1 ) / abs(l.p2 - l.p1);
//	double base = sqrt(c.r * c.r - norm(pr - c.c));
//	return mp(pr + e * base, pr - e * base);
//}
//
////????????????????????????
//static const int IN_POLYGON = 2;//????§???¢????????¨
//static const int OUT_POLYGON = 1;//????§???¢????????¨
//static const int ON_POLYGON = 0;//????§???¢????????????
//int contains(Polygon g, Point p) {
//	int n = g.size();
//	bool x = false;
//	rep(i, n) {
//		Point a = g[i] - p, b = g[( i + 1 ) % n] - p;
//		if (abs(cross(a, b)) < EPS && dot(a, b) < EPS) return OUT_POLYGON;
//		if (a.y > b.y) swap(a, b);
//		if (a.y < EPS && EPS < b.y && cross(a, b)) x = !x;
//	}
//	return ( x ? IN_POLYGON : ON_POLYGON );
//}

//??????
Polygon ConvexHull(Polygon s) {
	Polygon u, l;
	if (s.size() < 3) return s;
	sort(s.begin(), s.end());
	u.push_back(s[0]);
	u.push_back(s[1]);
	l.push_back(s[s.size() - 1]);
	l.push_back(s[s.size() - 2]);

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

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

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

/*
#define i(x) int x; scanf("%d",&x);
#define l(x) ll x; scanf("%lld",&x);
#define d(x) double  x; scanf("%lf",&x);
*/
//??????????£?????????°???
//https://www23.atwiki.jp/akitaicpc/pages/65.html


int main() {
	/*double xp1, yp1, xp2, yp2; put xp1 >> yp1 >> xp2 >> yp2;
	Segment s;
	s.p1 = Point(xp1, yp1);
	s.p2 = Point(xp2, yp2);

	int n; put n;
	rep(i, n) {
		Point p;
		put p.x >> p.y;
		Point prj =reflection(s, p);
		cout << setprecision(13) << prj.x << " " << prj.y << endl;
	}*/

	int n; put n;
	Polygon p;
	rep(i, n) {
		double x, y; put x >> y;
		p.push_back(Point(x, y));
	}
	Polygon k = ConvexHull(p);
	double tmpMax = 100000000.0;
	int rotIndex = 0;
	rep(i, k.size()) {
		if (k[i].y < tmpMax) {
			rotIndex = i;
			tmpMax = k[i].y;
		}
	}
	rotate(k.begin(),k.begin() + rotIndex,k.end());
	cout << k.size() << endl;
	rep(i, k.size()) {
		cout << k[i].x << " " << k[i].y << endl;
	}


	//???????????¬??????????????\???????????????
//	auto getI = [&]()->auto { int tmp; put tmp; return tmp; };
//	auto getLL = [&]()->auto { ll tmp; put tmp; return tmp; };
//	auto getS = [&]()->auto { string tmp; put tmp; return tmp; };
//	bool filled[1000][1000];
//	fill(*filled, *filled + 1000 * 1000, false);
//	int vx[4] = { 1,0,-1,0 };
//	int vy[4] = { 0,1,0,-1 };
//	Polygon sheep;
//	Polygon convex_sheep;
//	int num = 0;
//	int h, w; put h >> w;
//	rep(i, h) {
//		string s; put s;
//		rep(j, s.size()) {
//			if (s[j] == 'X') {
//				if (i == 0 || j == 0) {
//					putans(-1);
//					goto END;
//				}
//				rep(k, 4) {
//					if (!filled[i + vx[k]][j + vy[k]]) {
//						sheep.push_back(Point(i + vx[k],j + vy[k]));
//						filled[i + vx[k]][j + vy[k]] = true;
//					}
//				}
//			}
//		}
//	}
//	convex_sheep = ConvexHull(sheep);
//
//	rep(i, convex_sheep.size()) {
//		Point s = convex_sheep[i % convex_sheep.size()];
//		Point g = convex_sheep[(i + 1) % convex_sheep.size()];
//		int mandist = abs(s.x - g.x)+abs(s.y - g.y)-1;
//		max(1.0, abs(s.x - g.x)) + max(1.0, abs(s.y - g.y))
//		num += mandist;
//	} 
//	putans(num);
//END:
	return 0;
}

//
//int n, a, b; put n >> a >> b;
//	vi t;
//	rep(i, n) {
//		t.push_back(get());
//	}
//	int count = 0;
//	rep(i, n) {
//		if (t[i] < a || b <= t[i])count++;
//	}
//	putans(count);

//
//	set<string> list;
//	int ans = 0;
//	int n; put n;
//	int k; put k;
//	int numAlphabet[26];
//	fill(all(numAlphabet), 0);
//	rep(i, n) {
//		string s; put s;
//		if (exist(list, s))continue;
//		list.insert(s);
//		numAlphabet[s[0] - 'A']++;
//	}
//	sort(all(numAlphabet),greater<int>());
//	while (true) {
//		rep(i, k) {
//			if (numAlphabet[i] == 0) goto END;
//			else numAlphabet[i]--;
//		}
//		sort(all(numAlphabet), greater<int>());
//		ans++;
//	}
//END:
//	putans(ans);


	//int t; put t;
	//rep(i, t) {
	//	int n, d; put n >> d;
	//	if (n == 1) {
	//		putans(d);
	//		continue;
	//	}
	//	putans(n % 2 != 0 ? ( n - 1 ) * 127 + d : ( n - 1 ) * 127 + ( 127 ^ d ));
	//}


//
//int n; put n;
//string s1, s2;
//string r;
//string patan1[4] = { ".","#",".","#" };
//string patan2[4] = { ".",".","#","#" };
//bool front = true;
//rep(j, 420 / 4) {
//	if (front) {
//		rep(i, 4) {
//			cout << s1 + patan1[i] + "\n" << s2 + patan2[i] << endl;
//			cin >> r;
//			if (r == "T") {
//				s1 += patan1[i];
//				s2 += patan2[i];
//				break;
//			}
//			if (r == "F" && i == 3) {
//				front = !front;
//			}
//			if (r == "end")goto END;
//		}
//	}
//	else {
//		rep(i, 4) {
//			cout << patan1[i] + s1 + "\n" << patan2[i] + s2 << endl;
//			cin >> r;
//			if (r == "T") {
//				s1 = patan1[i] + s1;
//				s2 = patan2[i] + s2;
//				break;
//			}
//			if (r == "F" && i == 3) {
//				front = !front;
//			}
//			if (r == "end")goto END;
//		}
//	}
//
//}
//END:
//cout << endl;

Measured memory_bytes: 10540