#include <bits/stdc++.h>

using namespace std;

struct point:pair<int,int>
{
    point(int x = 0, int y = 0)
    {
        first = x, second = y;
    }

    int Manhattan_dist(const point& p) const
    {
        return abs(first-p.first)+abs(second-p.second);
    }

    friend istream& operator >> (istream& in, point& p)
    {
        return in >> p.first >> p.second;
    }

    friend ostream& operator << (ostream& out, const point& p)
    {
        return out << p.first << ' ' << p.second;
    }
};

struct points:set<point>
{
    void connect(const point& s, const point& t)
    {
        int x = s.first, y = s.second, 
        	u = t.first, v = t.second;

        for(int z = x+1; z <= u; x = z++) // move right
            emplace(z,y);

        for(int z = y+1; z < v; y = z++) // move up 
            emplace(x,z);
       
        for(int z = y-1; z > v; y = z--) // move down
            emplace(x,z);

        insert(t);
    }

    points(int n)
    {
        vector<point> p(n);

        for(auto&q:p)
            cin >> q;

        sort(p.begin(),p.end()), insert(p[0]), connect(p[0],p[1]);

        for(int i = 2; i < n; i++)
        {
            point src; int d_min = INT_MAX; bool connected = false;

            for(auto q:*this)
                if (q == p[i])
                {
                    connected = true; break;
                }
                else
                {
                	int d = q.Manhattan_dist(p[i]);
                	
                	if(d < d_min)
                        src = q, d_min = d;
            	}

            if (not connected)
                connect(src,p[i]);
        }
    }

    friend ostream& operator << (ostream& out, const points& s)
    {
        out << s.size();

        for(auto p:s)
            out << '\n' << p;

        return out;
    }
};

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

	int n; cin >> n; cout << points(n);
}