#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000;
int n, A[100001], B[2][100001], s, t, g0 = 0, g1 = 0, s0, s1, code, ans = 0,
                                      Answers[2][100000], p0, p1;
void quicksort(int l, int r) {
  int i = l, j = r, m = (l + r) / 2, t;
  do {
    while ((Answers[0][i] < Answers[0][m]) ||
           (Answers[0][i] == Answers[0][m] && Answers[1][i] < Answers[1][m]))
      i++;
    while ((Answers[0][j] > Answers[0][m]) ||
           (Answers[0][j] == Answers[0][m] && Answers[1][j] > Answers[1][m]))
      j--;
    if (i <= j) {
      t = Answers[0][i];
      Answers[0][i] = Answers[0][j];
      Answers[0][j] = t;
      t = Answers[1][i];
      Answers[1][i] = Answers[1][j];
      Answers[1][j] = t;
      i++;
      j--;
    }
  } while (i <= j);
  if (i <= r) quicksort(i, r);
  if (l <= j) quicksort(l, j);
}
void Init() {
  cin >> n;
  B[0][0] = 0;
  B[1][0] = 0;
  for (int i = 1; i < n + 1; i++) {
    cin >> A[i];
    A[i]--;
    B[A[i]][i] = B[A[i]][i - 1] + 1;
    B[1 - A[i]][i] = B[1 - A[i]][i - 1];
  }
}
int BinSearch(int player, int g, int l, int r) {
  if (l != r) {
    int m = (l + r) / 2;
    if (B[player][m] >= g)
      BinSearch(player, g, l, m);
    else
      BinSearch(player, g, m + 1, r);
  } else {
    if (B[player][l] == g)
      return l;
    else
      return inf;
  }
}
int main() {
  Init();
  int i;
  for (int h = 1; h < n + 1; h++) {
    t = h;
    i = 1;
    s0 = 0;
    s1 = 0;
    g0 = 0;
    g1 = 0;
    code = 0;
    if (t < 16) {
      while (i < n + 1) {
        if (B[0][i] > B[0][i - 1]) g0++;
        if (B[1][i] > B[1][i - 1]) g1++;
        if (g0 == t) {
          g0 = 0;
          g1 = 0;
          s0++;
          if (i == n) code = 1;
        } else if (g1 == t) {
          g0 = 0;
          g1 = 0;
          s1++;
          if (i == n) code = 1;
        }
        i++;
      }
      if (code == 1) {
        if (s0 > s1 && A[n] == 0) {
          Answers[0][ans] = s0;
          Answers[1][ans] = t;
          ans++;
        } else if (s1 > s0 && A[n] == 1) {
          Answers[0][ans] = s1;
          Answers[1][ans] = t;
          ans++;
        }
      }
    } else {
      while (code == 0) {
        p0 = BinSearch(0, g0 + t, i, n);
        p1 = BinSearch(1, g1 + t, i, n);
        if (p0 == inf && p1 == inf)
          code = 2;
        else {
          if (p0 < p1) {
            s0++;
            g0 = B[0][p0];
            g1 = B[1][p0];
            if (p0 == n) code = 1;
          } else {
            s1++;
            g0 = B[0][p1];
            g1 = B[1][p1];
            if (p1 == n) code = 1;
          }
        }
      }
      if (code == 1) {
        if (s0 > s1 && A[n] == 0) {
          Answers[0][ans] = s0;
          Answers[1][ans] = t;
          ans++;
        } else if (s1 > s0 && A[n] == 1) {
          Answers[0][ans] = s1;
          Answers[1][ans] = t;
          ans++;
        }
      }
    }
  }
  quicksort(0, ans - 1);
  cout << ans << endl;
  for (int i = 0; i < ans; i++)
    cout << Answers[0][i] << " " << Answers[1][i] << endl;
  return 0;
}
