#include <bits/stdc++.h>
using namespace std;
int w, n, a[100010], sum1[100010], sum2[100010];
struct data {
  int x, y;
  bool operator<(const data& r) const { return x < r.x; }
} dap[100010];
int main() {
  int i, j, cnt1, cnt2, *p1, *p2, pos1, pos2;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum1[i] = sum1[i - 1];
    sum2[i] = sum2[i - 1];
    if (a[i] == 1)
      sum1[i]++;
    else
      sum2[i]++;
  }
  for (i = 1; i <= n; i++) {
    j = cnt1 = cnt2 = 0;
    while (1) {
      p1 = lower_bound(sum1 + j, sum1 + n + 1, sum1[j] + i);
      p2 = lower_bound(sum2 + j, sum2 + n + 1, sum2[j] + i);
      pos1 = p1 - sum1;
      pos2 = p2 - sum2;
      if (pos1 > pos2)
        j = pos2, cnt2++;
      else
        j = pos1, cnt1++;
      if (j > n) break;
      if (j == n) {
        if (pos1 > pos2 && cnt2 > cnt1) {
          w++;
          dap[w].x = cnt2;
          dap[w].y = i;
        }
        if (pos1 < pos2 && cnt2 < cnt1) {
          w++;
          dap[w].x = cnt1;
          dap[w].y = i;
        }
        break;
      }
    }
  }
  sort(dap + 1, dap + w + 1);
  printf("%d\n", w);
  for (i = 1; i <= w; i++) printf("%d %d\n", dap[i].x, dap[i].y);
  return 0;
}
