import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class polygon_as implements Runnable {

    public void solve() throws IOException {
        Scanner in = new Scanner(new File("polygon.in"));
        PrintWriter out = new PrintWriter(new File("polygon.out"));

        int n = in.nextInt();
        int[] a = new int[n];
        int s = 0;
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            s += a[i];
        }

        int[][] mx = new int[n + 1][s + 1];
        int[][] from = new int[n + 1][s + 1];

        Arrays.fill(mx[0], (int) -1);
        mx[0][0] = 0;
        for (int i = 0; i < n; i++) {
            Arrays.fill(mx[i + 1], -1);
            for (int j = 0; j < s + 1; j++) {
                if (mx[i][j] != -1) {
                    if (mx[i + 1][j] < mx[i][j]) {
                        mx[i + 1][j] = mx[i][j];
                        from[i + 1][j] = 0;
                    }
                    int k = abs(j - a[i]);
                    if (mx[i + 1][k] < mx[i][j] + 1) {
                        mx[i + 1][k] = mx[i][j] + 1;
                        if (j < a[i]) {
                            from[i + 1][k] = 1;
                        } else {
                            from[i + 1][k] = -1;
                        }
                    }
                    if (mx[i + 1][j + a[i]] < mx[i][j] + 1) {
                        mx[i + 1][j + a[i]] = mx[i][j] + 1;
                        from[i + 1][j + a[i]] = 1;
                    }
                }
            }
        }

        out.println(mx[n][0]);
        if (mx[n][0] > 0) {
            ArrayList<Integer>[] d = new ArrayList[2];
            d[0] = new ArrayList<Integer>();
            d[1] = new ArrayList<Integer>();

            int p = n;
            int z = 0;
            int w = 0;
            while (p > 0) {
                switch (from[p][z]) {
                    case 1:
                        d[w].add(a[p - 1]);
                        z -= a[p - 1];
                        if (z < 0) {
                            w = 1 - w;
                            z = -z;
                        }
                        break;
                    case -1:
                        d[1 - w].add(a[p - 1]);
                        z += a[p - 1];
                        break;
                }
                p--;
            }

            int y = 0;
            int x = 0;
            for (int l : d[0]) {
                out.println(x + " " + y);
                out.println((x + l) + " " + y);
                x += l;
                y++;
            }
            for (int l : d[1]) {
                out.println(x + " " + y);
                out.println((x - l) + " " + y);
                x -= l;
                y++;
            }

            assert x == 0;
        }

        in.close();
        out.close();
    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            System.exit(64);
        }
    }

    public static void main(String[] arg) throws IOException {
        new Thread(new polygon_as()).start();
    }
}
