1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {

    int vertices;
    cin >> vertices;
    int leaves = 0;
    for (int i = 0; i < vertices; i++) {
      int degree;
      cin >> degree;
      if (degree == 1) {
        leaves++;
      }
    }

    if (leaves > 2) {
      leaves = 2;
    }
    printf("%d\n", 2 - leaves);
    printf("2\n");
    printf("1 2\n");

    return 0;
    
}