#include <bits/stdc++.h>
#define int long long
using namespace std;

typedef pair<double,double> P;

double cross(P a, P b){
  return a.first * b.second - a.second * b.first;
}

bool check(P a, P b, P c){
  
  b.first -= a.first;
  b.second -= a.second;

  c.first -= a.first;
  c.second -= a.second;
  
  if( cross( b, c ) > (1e-8) ) return false;
  
  return true;
}

int n;
vector<P> points[2], ans[2], S;

void cal(int idx, P start){
  
  for(int i=0;i<n;i++){
    
    if( idx == 0 ) points[idx][i].second *= -1;
    else points[idx][i].first *= -1;
    
  }
  
  int flg = 0;
  
  for(int i=0;i<n;i++){
    
    if( idx == 1 && start == points[idx][i] ){
      flg = 1;
      ans[idx].push_back( points[idx][i] );
      continue;
    }
    
    if( idx == 1 && flg == 0 ) continue;
    
    if( ans[idx].size() <= 1 ){
      
      ans[idx].push_back( points[idx][i] );
      
    }
    else{

      while( ans[idx].size() >= 2 ){
      
	P a = ans[idx][ans[idx].size()-2];
	P b = ans[idx][ans[idx].size()-1];
	P c = points[idx][i];
      
	if( check( a, b, c ) == true ) break;
	else ans[idx].pop_back();
	
      }
      
      ans[idx].push_back( points[idx][i] );
      
    }

  }
  
}

signed main(){
  
  cin>>n;
  
  for(int i=0;i<n;i++){
    
    int x, y;
    cin>>x>>y;
    
    points[0].push_back(P( x, -y ));
    
    points[1].push_back(P( -x, y ));

    S.push_back(P( y, x ));
    
  }
  
  sort( S.begin(), S.end() );
  
  for(int i=0;i<n;i++) swap( S[i].first, S[i].second );
  
  for(int i=0;i<2;i++) sort( points[i].begin(), points[i].end() );
  
  cal( 0, points[0][0] );
  
  cal( 1, ans[0][ans[0].size()-1] );
  
  for(int i=0;i<2;i++){
    
    for(int j=0;j<ans[i].size();j++){
      
      if( ans[i][j].first == -0 ) ans[i][j].first = 0;
      if( ans[i][j].second == -0 ) ans[i][j].second = 0;
    }
    
  }
  
  vector<P> Ans;
  set<P> used;
  
  int flg = 0;
  
  for(int i=ans[1].size()-1;i>=0;i--){
    
    if( S[0] == ans[1][i] ) flg = 1;
    
    if( flg == 0 ) continue;
    
    if( used.count( ans[1][i] ) ) continue;
    
    used.insert( ans[1][i] );
    
    Ans.push_back( ans[1][i] );
    
  }
  
  for(int i=ans[0].size()-1;i>=0;i--){
    
    if( used.count( ans[0][i] ) ) continue;
    
    used.insert( ans[0][i] );
    
    Ans.push_back( ans[0][i] );
    
  }
  
  for(int i=ans[1].size()-1;i>=0;i--){
    
    if( used.count( ans[1][i] ) ) continue;
    
    used.insert( ans[1][i] );
    
    Ans.push_back( ans[1][i] );
    
  }

  cout<<Ans.size()<<endl;
    
  for(P p : Ans) cout<<p.first<<' '<<p.second<<endl;
  
  return 0;
}

