#include <bits/stdc++.h>
std::vector<std::pair<int, int> > ans;
int v[100009];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int first;
    scanf("%d", &first);
    v[i] = v[i - 1] + (first == 1);
  }
  for (int i = 1; i <= n; i++) {
    int p = 1, last, s1 = 0, s2 = 0;
    bool f = 1;
    while (p <= n) {
      int rez = p - 1;
      for (int pas = 1 << 16; pas; pas >>= 1)
        if ((rez + pas <= n) && (v[rez + pas] - v[p - 1] < i) &&
            ((rez + pas - (p - 1)) - (v[rez + pas] - v[p - 1]) < i))
          rez += pas;
      rez++;
      if (rez <= n) {
        if (v[rez] - v[p - 1] == i) {
          last = 1;
          s1++;
        } else {
          last = 2;
          s2++;
        }
      } else
        f = 0;
      p = rez + 1;
    }
    if (f) {
      if ((s1 > s2) && (last == 1)) ans.push_back(std::pair<int, int>(s1, i));
      if ((s2 > s1) && (last == 2)) ans.push_back(std::pair<int, int>(s2, i));
    }
  }
  std::sort(ans.begin(), ans.end());
  printf("%u\n", ans.size());
  for (auto first : ans) printf("%d %d\n", first.first, first.second);
  return 0;
}
