#include <bits/stdc++.h>
using namespace std;
int n, a[300005];
int posa[300005], posb[300005];
int tot1[300005], tot2[300005];
vector<pair<int, int> > ans;
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(posa, -1, sizeof(posa));
  memset(posb, -1, sizeof(posb));
  int cnta = 0, cntb = 0;
  for (i = 1; i <= n; i++) {
    if (a[i] == 1) {
      cnta++;
      posa[cnta] = i;
      tot1[i] = tot1[i - 1] + 1;
      tot2[i] = tot2[i - 1];
    } else {
      cntb++;
      posb[cntb] = i;
      tot1[i] = tot1[i - 1];
      tot2[i] = tot2[i - 1] + 1;
    }
  }
  for (i = 1; i <= n; i++) {
    int s1 = 0, s2 = 0, pp = 1, offset1 = 0, offset2 = 0, mylast = 0;
    for (;;) {
      int pa = posa[offset1 + i], pb = posb[offset2 + i];
      if (pa == -1 && pb == -1)
        break;
      else if (pa == -1) {
        s2++;
        pp = pb + 1;
        offset1 = tot1[pp - 1];
        offset2 = tot2[pp - 1];
        mylast = 2;
        continue;
      } else if (pb == -1) {
        s1++;
        pp = pa + 1;
        offset1 = tot1[pp - 1];
        offset2 = tot2[pp - 1];
        mylast = 1;
        continue;
      }
      if (pa < pb) {
        mylast = 1;
        s1++;
        pp = pa + 1;
        offset1 = tot1[pp - 1];
        offset2 = tot2[pp - 1];
      } else {
        mylast = 2;
        s2++;
        pp = pb + 1;
        offset1 = tot1[pp - 1];
        offset2 = tot2[pp - 1];
      }
    }
    if (pp <= n) continue;
    if ((mylast == 1 && s1 <= s2) || (mylast == 2 && s2 <= s1)) continue;
    ans.push_back(make_pair(max(s1, s2), i));
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
