#include <bits/stdc++.h>
using namespace std;
vector<int> vec[2];
int getidx(int i, int j, int v) {
  if (j + v - 1 < vec[i].size()) return j + v - 1;
  return -1;
}
int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    vec[--x].push_back(i + 1);
  }
  vector<pair<int, int> > ans;
  for (int i = 1; i <= n; ++i) {
    int a = 0, b = 0, as = 0, bs = 0;
    bool c = 1;
    while (1) {
      int na = getidx(0, a, i), nb = getidx(1, b, i);
      if (na == -1 && nb == -1) {
        c = 0;
        break;
      }
      if (na == -1) {
        if (vec[1][nb] == n) {
          ++bs;
          if (as >= bs) c = 0;
          break;
        } else {
          bs++;
          b = nb + 1;
        }
      } else if (nb == -1) {
        if (vec[0][na] == n) {
          ++as;
          if (bs >= as) c = 0;
          break;
        } else {
          as++;
          a = na + 1;
        }
      } else {
        if (vec[0][na] < vec[1][nb]) {
          as++;
          a = na + 1;
          b = lower_bound(vec[1].begin(), vec[1].end(), vec[0][na]) -
              vec[1].begin();
        } else {
          bs++;
          b = nb + 1;
          a = lower_bound(vec[0].begin(), vec[0].end(), vec[1][nb]) -
              vec[0].begin();
        }
      }
    }
    if (c) {
      ans.push_back(make_pair(max(as, bs), i));
    }
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", (int)ans.size());
  for (auto x : ans) {
    printf("%d %d\n", x.first, x.second);
  }
}
