#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
template <class T>
void chmin(T &a, T b) { a = min(a, b); }
template <class T>
void chmax(T &a, T b) { a = max(a, b); }
void ok() { cerr << "ok" << endl; }
using D = double;
using Point = complex<D>;
const D eps = 1e-40;
inline int sgn(const D &a) { return (a < -eps) ? -1 : (a > eps) ? 1 : 0; }
inline D cross(const Point &a, const Point &b) {
    return a.real() * b.imag() - a.imag() * b.real();
}
inline D dot(const Point &a, const Point &b) {
    return a.real() * b.real() + a.imag() * b.imag();
}
istream &operator>>(istream &is, Point &p) {
    D a, b;
    is >> a >> b;
    p = Point(a, b);
    return is;
}
ostream &operator<<(ostream &os, Point &p) {
    os << p.real() << " " << p.imag();
    return os;
}
inline int ccw(const Point &a, Point b, Point c) {
    D d = cross(b - a, c - a);
    if (sgn(d) > 0) {
        return +1; //anti-clockwise
    } else if (sgn(d) < 0) {
        return -1; //clockwise
    } else {
        if (sgn(dot(b - a, c - a)) < 0) {
            return -2;
        } else if (sgn(dot(a - b, c - b)) < 0) {
            return +2;
        }
    }
    return 0;
}
struct ConvexHull : vector<Point> {
    vector<Point> pt;
    ConvexHull(const vector<Point> &pt) : pt(pt) {}
    void build() {
        auto cmp = [](const Point &a, const Point &b) {
            return a.imag() == b.imag() ? a.real() < b.real() : a.imag() < b.imag();
        };
        sort(pt.begin(), pt.end(), cmp);
        int k = 0;
        resize(pt.size() * 2);
        for (int i = 0; i < pt.size(); i++) {
            while (k > 1 && ccw((*this)[k - 2], (*this)[k - 1], pt[i]) <= 0) {
                k--;
            }
            (*this)[k++] = pt[i];
        }
        int lim = k;
        for (int i = (int)pt.size() - 2; i >= 0; i--) {
            while (k > lim && ccw((*this)[k - 2], (*this)[k - 1], pt[i]) <= 0) {
                k--;
            }
            (*this)[k++] = pt[i];
        }
        resize(k - 1);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<Point> pt(n);
    for (int i = 0; i < n; i++) {
        cin >> pt[i];
    }
    ConvexHull ch(pt);
    ch.build();
    cout << ch.size() << '\n';
    for (int i = 0; i < ch.size(); i++) {
        cout << ch[i] << '\n';
    }
}
