#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define pii pair<int, int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,n,0)
#define ALL(c) ((c).begin(),(c).end())
#define PB(a) push_back(a)
#define EMPB(...) emplace_back(__VA_ARGS__)
#define EMP(...) emplace(__VA_ARGS__)
#define MP(a,b) make_pair(a,b)
#define MT(...) make_tuple(__VA_ARGS__)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define PW(n) (1LL<<(n))
using namespace std;
template <class T> inline bool CHMIN(T& a, T b) { if(a>b) { a=b; return 1; } return 0; }
template <class T> inline bool CHMAX(T& a, T b) { if(a<b) { a=b; return 1; } return 0; }
template <class T> inline void SORT(T& a) { sort(ALL(a)); }
template <class T> inline void REV(T& a) { reverse(ALL(a)); }
template <class T> inline void UNI(T& a) { SORT(a); a.erase(unique(ALL(a)),a.end()); }
template <class S, class T> ostream& operator<<(ostream& os, const pair<S,T> a) {
  return os << a.first << ' ' << a.second;
}
const int MOD = 1000000007;
// const int INF = 0x3f3f3f3f3f3f3f3f;
// const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

/* 基本要素 */
using D = double; // 座標値の型 doubleかlong double
using P = complex<D>; // Point
using L = pair<P,P>;  // Line
using VP = vector<P>;
const double EPS = 1e-8;  // 許容誤差
const double INF = 1e12;
#define X real()
#define Y imag()
#define LT(n,m) ((n)+EPS<(m)) // n < m ?
#define LE(n,m) ((n)-EPS<(m)) // n <= m ?
#define GT(n,m) LT(m,n) // n > m ?
#define GE(n,m) LE(m,n) // n >= m ?
#define EQ(n,m) (abs((n)-(m))<EPS)
#define NE(n,m) !EQ(n,m)
#define rep(i,n) for (int i=0;i<(n);++i)

namespace std {
  istream& operator >> (istream& is, P& p) {
    int F, S;
    is >> F >> S;
    p = P(F,S);
    return is;
  }
}

// 内積
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積
D cross(P a, P b) {
  return (conj(a)*b).Y;
}
// 点aから見た、点bから点cへの方向
int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (GT(cross(b,c),0)) return +1;  // counter clockwise
  if (LT(cross(b,c),0)) return -1;  // clockwise
  if (LT(dot(b,c),0)) return +2;  // c--a--b on line
  if (LT(norm(b),norm(c))) return -2; // a--b--c on line or a==b
  return 0;                     // a--c--b on line or a==c or b==c
}

/* 多角形 */
// 頂点の順序(sortやmax_elementに必要)
namespace std {
  bool operator < (const P a, const P b) {
    return a.X != b.X ? LT(a.X,b.X) : LT(a.Y,b.Y);
  }
}
// 凸包
VP convexHull(VP ps) {
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end());
  VP ch(2*n);
  for (int i = 0; i < n; ch[k++] = ps[i++])
    while (k >= 2 && ccw(ch[k-2],ch[k-1],ps[i]) == -1) --k;  // 余計な点も含むなら == -1 とする
  for (int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--])
    while (k >= t && ccw(ch[k-2],ch[k-1],ps[i]) == -1) --k;  // 余計な点も含むなら == -1 とする
  ch.resize(k-1);
  return ch;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n;
  cin >> n;
  VP ps(n);
  REP(i,n) cin >> ps[i];
  ps = convexHull(ps);
  VP qs;
  P mn = P(INF,INF);
  int idx = -1;
  REP(i,ps.size()) {
    if (ps[i].Y < mn.Y) mn = ps[i], idx = i;
    else if (ps[i].Y == mn.Y && ps[i].X < mn.X) mn = ps[i], idx = i;
  }
  REP(i,ps.size()) qs.PB(ps[(idx+i)%ps.size()]);
  cout << qs.size() << endl;
  for (auto p : qs) {
    cout << (int)p.X << " " << (int)p.Y << endl;
  }
  
  return 0;
}


Measured memory_bytes: 9024