#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
#define x real() 
#define y imag()
#define px second
#define py first
using namespace std;
typedef complex<double> vectol;
typedef pair <int,int> P;
P G[100001];
vector <P> stc;

int ccw(vectol a,vectol b,vectol c) {
  vectol ab=b-a, ac =c-a;
  vectol d =ac*conj(ab); 
  if(d.y > 0) return true;
  return false;
}

int mk(int i,int flg) {
  vectol av = vectol(stc[stc.size()-2].px,stc[stc.size()-2].py);
  vectol bv = vectol(stc[stc.size()-1].px,stc[stc.size()-1].py);
  vectol cv = vectol(G[i].px,G[i].py);
  if(ccw(av,bv,cv) && stc.size()!=1)stc.pop_back(),i+=flg;
  else  stc.push_back(G[i]);
  return i;
}

int main() {
  int n;
  cin >> n;
  for(int i=0;i<n;i++)cin >> G[i].px >> G[i].py;
  sort(G,G+n);
  
  stc.push_back(G[0]),stc.push_back(G[1]);
  for(int i=2;i<n;i++) i=mk(i,-1);
  for(int i=n-2;i>=0;i--) i=mk(i,1);
  
  cout <<stc.size()-1<<endl;
  for(int i=stc.size()-1;i>0;i--) cout<<stc[i].px <<" "<<stc[i].py<<endl;
  return 0;
}