#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

class Vec;
Vec operator/(const Vec& v, const double& divisor);
Vec operator*(const double& scale, const Vec& v);

class Vec {
  using F = double;
  vector<F> container;

 public:
  Vec(size_t size) : container(size) {}
  Vec(initializer_list<F> elements)
      : container(elements.begin(), elements.end()) {}
  size_t dim() const { return container.size(); }
  F& operator[](const size_t size) { return container.at(size); }
  const F& operator[](const size_t size) const { return container.at(size); }
  Vec operator+(const Vec& other) const {
    Vec ret(*this);
    for (size_t i = 0; i < dim(); i++) ret[i] += other[i];
    return ret;
  }
  Vec operator-(const Vec& other) const { return (*this) + (-other); }
  Vec operator-() const { return -1.0 * (*this); }
  F inner(const Vec& other) const {
    F acc = 0;
    for (size_t i = 0; i < dim(); i++) {
      acc += (*this)[i] * other[i];
    }
    return acc;
  }
  F norm() const { return sqrt(inner(*this)); }
  Vec unit() const { return (*this) / this->norm(); }
  F ccw(const Vec& other) const {
    return (*this)[0] * other[1] - other[0] * (*this)[1];
  }
  Vec normal() const { return Vec({-(*this)[1], (*this)[0]}); }
};
Vec operator/(const Vec& v, const double& divisor) { return 1.0 / divisor * v; }
Vec operator*(const double& scale, const Vec& v) {
  Vec ret(v);
  for (size_t i = 0; i < ret.dim(); i++) ret[i] *= scale;
  return ret;
}

class Convex {
  const vector<Vec>& m_points;
  vector<int> m_hull;

 public:
  Convex(const vector<Vec>& points) : m_points(points), m_hull() {
    const size_t n = m_points.size();

    vector<int> idx(n);
    for (size_t i = 0; i < n; i++) idx[i] = i;
    sort(idx.begin(), idx.end(), [&](const int& lh, const int& rh) {
      if (m_points[lh][0] == m_points[rh][0]) {
        return m_points[lh][1] < m_points[rh][1];
      }
      return m_points[lh][0] < m_points[rh][0];
    });

    vector<int> conv[2];
    double si = 1;
    for (int j = 0; j < 2; j++) {
      vector<int>& cv = conv[j];
      for (size_t i = 0; i < n; i++) {
        const int k = idx[i];
        const Vec& c = m_points[k];
        while (cv.size() >= 2 &&
               si * (m_points[cv[cv.size() - 1]] - m_points[cv[cv.size() - 2]])
                           .ccw(c - m_points[cv[cv.size() - 2]]) <
                   0) {
          cv.pop_back();
        }
        cv.push_back(k);
      }
      si *= -1;
    }

    copy(conv[0].begin(), conv[0].end(), back_inserter(m_hull));
    copy(next(conv[1].rbegin()), prev(conv[1].rend()), back_inserter(m_hull));
  }
  size_t size() const { return m_hull.size(); }
  const vector<int>& ids() const { return m_hull; }
  const Vec& operator[](size_t index) const {
    return m_points.at(m_hull.at(index));
  }
};

int main() {
  int n;
  cin >> n;

  vector<Vec> p;
  rep(i, n) {
    double x, y;
    cin >> x >> y;
    p.push_back(Vec({x, y}));
  }

  auto hull = Convex(p);

  const int m = hull.size();
  cout << m << endl;
  rep(i, m) {
    if (!(hull[i][1] > hull[(i + 1) % m][1])) {
      rep(j, m) {
        const int idx = (i + j) % m;
        cout << hull[idx][0] << " " << hull[idx][1] << "\n";
      }
      return 0;
    }
  }
  return 0;
}



Measured memory_bytes: 8676