#include <bits/stdc++.h>
#include <cmath>

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

//bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;


void print_line(vector<string> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}

#define EPS (1e-10)

struct Point {
    double x, y;

    Point(double x = 0, double y = 0) : x(x), y(y) {}

    Point operator+(Point p) { return Point(x + p.x, y + p.y); }

    Point operator-(Point p) { return Point(x - p.x, y - p.y); }

    Point operator*(double a) { return Point(a * x, a * y); }

    Point operator/(double a) { return Point(x / a, y / a); }

    double abs() { return sqrt(norm()); }

    double norm() { return x * x + y * y; }

    bool operator<(const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }

    bool operator==(const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
};

typedef Point Vector;
typedef vector<Point> Polygon;


static const int IN = 2;
static const int ON = 1;
static const int OUT = 0;

double dot(Vector a, Vector b) {
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
    return a.x * b.y - a.y * b.x;
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;   // p2->p0->p1
static const int ONLINE_FRONT = -2; // p0->p1->p2
static const int ON_SEGMENT = 0;    // p0->p2->p1

double norm(Point a){
    return a.x * a.x + a.y * a.y;
}

int ccw(Point p0, Point p1, Point p2) {
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
    if (cross(a, b) < -EPS) return CLOCKWISE;
    if (dot(a, b) < -EPS) return ONLINE_BACK;
    if (norm(a) < norm(b)) return ONLINE_FRONT;
    return ON_SEGMENT;
}

Polygon f(Polygon g) {
    Polygon u, l;
    if (g.size() < 3) return g;
    sort(g.begin(), g.end());
    u.push_back(g[0]);
    u.push_back(g[1]);
    l.push_back(g[g.size() - 1]);
    l.push_back(g[g.size() - 2]);

    // upper
    for (int i = 2; i < g.size(); i++) {
        for (int n = u.size(); n >= 2 && ccw(u[n - 2], u[n - 1], g[i]) == COUNTER_CLOCKWISE; n--) {
            u.pop_back();
        }
        u.push_back(g[i]);
    }

    // lower
    for (int i = g.size() - 3; i >= 0; i--) {
        for (int n = l.size(); n >= 2 && ccw(l[n - 2], l[n - 1], g[i]) == COUNTER_CLOCKWISE; n--) {
            l.pop_back();
        }
        l.push_back(g[i]);
    }

    reverse(l.begin(), l.end());
    for (int i = u.size() - 2; i >= 1; i--) l.push_back(u[i]);

    return l;
}

int main() {
    int n;
    cin >> n;
    Polygon g;
    for (int i = 0; i < n; i++) {
        double x, y;
        cin >> x >> y;
        g.push_back(Point(x, y));
    }
    Polygon conv = f(g);
    cout << conv.size() << endl;
    int from = 0;
    for (int i = 1; i < conv.size(); i++) {
        if (conv[i].y < conv[from].y || (conv[i].y == conv[from].y && conv[i].x < conv[from].x)) {
            from = i;
        }
    }
    for (int i = 0; i < conv.size(); i++) {
        int x = (from + i) % conv.size();
        cout << conv[x].x << " " << conv[x].y << endl;
    }
    return 0;
}



Measured memory_bytes: 9536