#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
#define FOR(i, b, e) for (int i = b; i <= e; i++)
#define FORD(i, b, e) for (int i = b; i >= e; i--)
#define SIZE(x) ((int)(x).size())
#define BOOST ios_base::sync_with_stdio(false); cin.tie(0)

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
                                    

/*************************** END OF TEMPLATE ***************************/




PLL operator-(const PLL &a, const PLL &b)
{
        return {a.ST - b.ST, a.ND - b.ND};
}

// det(a, b, c) :
// a -> b -> c
// - jesli skret jest w lewo to jest na plusie
LL det(const PLL &a, const PLL &b, const PLL &c)
{
        return (a.ST * b.ND + b.ST * c.ND + c.ST * a.ND
                 - a.ND * b.ST - b.ND * c.ST - c.ND * a.ST);
}

vector<PLL> hull(vector<PLL> v)
{
        sort(v.begin(), v.end());
        vector<PLL> r;
        int minsize = 1;
        for(auto i : v)
        {
                while(SIZE(r) > minsize && det(r[SIZE(r) - 2], r.back(), i) > 0)
                        r.pop_back();
                r.push_back(i);
        }
        reverse(v.begin(), v.end());
        r.pop_back();
        minsize = SIZE(r) + 1;
        for(auto i : v)
        {
                while(SIZE(r) > minsize && det(r[SIZE(r) - 2], r.back(), i) > 0)
                        r.pop_back();
                r.push_back(i);
        }
        r.pop_back();
        return r;
}


LL dist(const PLL &a, const PLL &b)
{
        return (a.ST - b.ST) * (a.ST - b.ST) + (a.ND - b.ND) * (a.ND - b.ND);
}



int main()
{
        BOOST;
        
        int n;
        cin >> n;
        vector<PLL> v;
        while(n > 0)
        {
                int a, b;
                cin >> a >> b;
                v.PB({a, b});
                n--;
        }

        vector<PLL> h = hull(v);

        reverse(h.begin(), h.end());

        int m = 0;
        FOR(i, 0, SIZE(h) - 1)
                if(h[i].ND < h[m].ND || (h[i].ND == h[m].ND && h[i].ST < h[m].ST))
                        m = i;

        rotate(h.begin(), h.begin() + m, h.end());

        cout << SIZE(h) << endl;
        for(auto i : h)
                cout << i.ST << ' ' << i.ND << endl;



}



