#include<iostream>
#include<complex>
#include<array>
#include<vector>
#include<cstdio>
#include<cassert>
#include<algorithm>
using namespace std;

const double EPS = 1e-10;
template<class T>
bool eq(const T& a, const T& b) {return abs(a - b) < EPS;}

typedef  complex<double> point;
namespace std {
	bool operator==(const point &a, const point &b){
	  return eq(a, b);
	}
	bool operator<(const point& a, const point& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

double cross(const point& a, const point& b) {
	return imag(conj(a)*b);
}
double dot(const point& a, const point& b) {
	return real(conj(a)*b);
}
int ccw(point a, point b, point c) {
	b -= a; c -= a;
	if (cross(b, c)+EPS > 0)   return +1;  // counter clockwise
	if (cross(b, c) < EPS)   return -1;  // clockwise
	if (dot(b, c) < EPS)     return +2;  // c--a--b on line
	if (norm(b) < norm(c)+EPS) return -2;  // a--b--c on line
	return 0;  // a--c--b on line or a----bc
}

typedef array<point, 2> line;

point projection(const line& l, const point& p) {
	double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
	return l[0] + t*(l[0]-l[1]);
}

point reflection(const line& l, const point& p) {
return p + 2. * (projection(l, p) - p);
}
 typedef array<point, 2> line;
//using line = array<point, 2>;
/*
 * 平行かどうか
 */
bool is_parallel(const line& s, const line& t) {
	return eq(cross(s[0] - s[1], t[0] - t[1]), 0.0);
}

bool is_orthogonal(const line& s, const line& t) {
	return eq(dot(s[0] - s[1], t[0] - t[1]), 0.0);
}

// 交差
// Lはline（直線)
// Sはsegment(線分)
bool intersectLL(const line& l, const line& m) {
	return !eq(cross(l[1]-l[0], m[1]-m[0]), 0.) || // non-parallel
			eq(cross(l[1]-l[0], m[0]-l[0]), 0.);   // same line
}
bool intersectLS(const line& l, const line& s) {
	return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
	cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] is right of l
}
bool intersectLP(const line& l, const point& p) {
	return eq(cross(l[1]-p, l[0]-p), 0.);
}
bool intersectSS(const line &s, const line &t) {
	return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
	  ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}
bool intersectSP(const line &s, const point &p) {
	return abs(s[0]-p) + abs(s[1]-p) - abs(s[1]-s[0]) < EPS; // triangle inequality
}
point crosspoint(const line& l, const line& m) {
	double A = cross(l[1] - l[0], m[1] - m[0]);
	double B = cross(l[1] - l[0], l[1] - m[0]);
	if (eq(A, 0.) && eq(B, 0.)) return m[0]; // same line
	if (eq(A, 0.)) assert(false); // 交点が無い場合に落ちる 実行前に交差判定
	return m[0] + B / A * (m[1] - m[0]);
}


/* 距離 */
// Lはline（直線)
// Sはsegment(線分)
double distanceLP(const line& l, const point& p) {
  return abs(p - projection(l, p));
}
double distanceLL(const line& l, const line& m) {
  return intersectLL(l, m) ? 0 : distanceLP(l, m[0]);
}
double distanceLS(const line& l, const line& s) {
if (intersectLS(l, s)) return 0;
 return min(distanceLP(l, s[0]), distanceLP(l, s[1]));
}
double distanceSP(const line& s, const point& p) {
  const point r = projection(s, p);
  if (intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0] - p), abs(s[1] - p));
}
double distanceSS(const line& s, const line& t) {
  if (intersectSS(s, t)) return 0;
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
	     min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}

typedef vector<point> polygon;
//using polygon = vector<point>;

/* 面積の2倍(時計周りなら負) */
double area2(const polygon& P) {
	double A = 0;
	size_t n = P.size();
	for (int i = 0; i < n; ++i)
		A += cross(P[i], P[(i + 1) % n]);
	return A;
}

//凸包
//点集合 ps に対してその凸包を求める．
//O(n log n)

polygon convex_hull(polygon ps) {
  int n=ps.size(), k=0;
  sort(ps.begin(), ps.end(),[](const point& a, const point& b){
      return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b);
    });
  polygon ch(2*n);
  for (int i=0; i < n; ch[k++]=ps[i++]) // lower-hull
    while (k >= 2 &&  ccw(ch[k-2], ch[k-1], ps[i]) <= 0  ) --k;
  for (int i=n-2, t=k+1; i >= 0; ch[k++]=ps[i--]) // upper-hull
    while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) <= 0 ) --k;
  ch.resize(k-1);
  return ch;
}


int main()
{
  int q;
  cin>>q;
  polygon box;
  for(;q--;)
    {
      double x,y;
      cin>>x>>y;
      box.push_back(point(x,y));
    }

  polygon totu=convex_hull(box);
  cout<<totu.size()<<endl;
  for(int i=0;i<totu.size();i++)
    cout<<totu[i].real()<<" "<<totu[i].imag()<<endl;

}

Measured memory_bytes: 7348