// C++ 14
#include <math.h>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <string>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (*(x.end()-1))

using namespace std;

#define EPS 0.00000001
#define fequals(a,b) (fabs((a) - (b)) < EPS)

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (const Vector2 v) const { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (const Vector2 v) const { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (const double k) const { return Vector2(x * k, y * k); }
  Vector2 operator / (const double k) const { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 const v) { return x * v.x + y * v.y; }
  double cross (Vector2 const v) { return x * v.y - y * v.x; }
  
  bool parallel(Vector2 &other) {
    return fequals(fabs(dot(other)), length() * other.length());
  }
  
  bool orthogonal(Vector2 &other) {
    return fequals(0, dot(other));
  }
  
  bool operator < (const Vector2 &v) {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

#define MAX_N 100001

Int N;
vector<Vector2> points(MAX_N);

double cross(Vector2 p0, Vector2 p1, Vector2 p2) {
  return (p2 - p1).cross(p0 - p1);
}

void format(Vector2 &p) {
  cout << p.x << ' ' << p.y;
}

vector<Vector2> convex_hull(vector<Vector2> &points, Int N) {
  int n = N, k = 0;
  sort(points.begin(), points.end());
  vector<Vector2> ch(2*n);
  for (int i = 0; i < n; ch[k++] = points[i++])
    while (k >= 2 && cross(ch[k-2], ch[k-1], points[i]) < 0) --k;
  for (int i = n-2, t = k+1; i >= 0; ch[k++] = points[i--])
    while (k >= t && cross(ch[k-2], ch[k-1], points[i]) < 0) --k;
  ch.resize(k-1);
  return ch;
}

Int bottomleft_index(vector<Vector2> &points) {
  Int index = 0;
  Vector2 min_ = points[0];
  loop(n,1,points.size()) {
    if (points[n].y < min_.y) min_ = points[n],index = n;
    else if (points[n].y == min_.y && points[n].x < min_.x) min_ = points[n],index = n;
  }
  return index;
}

void solve() {
  vector<Vector2> result = convex_hull(points, N);
  cout << result.size() << endl;
  Int index = bottomleft_index(result);
  loop(n,index,result.size()) format(result[n]),cout << endl;
  loop(n,0,index) format(result[n]),cout << endl;
}

void input() {
  cin >> N;
  loop(n,0,N) cin >> points[n];
  points.resize(N);
}

int main() {
  cout.precision(15);
  input();
  solve();
}


Measured memory_bytes: 7532