#include <bits/stdc++.h>
using namespace std;
void RI() {}
template <typename... T>
void RI(int& head, T&... tail) {
  scanf("%d", &head);
  RI(tail...);
}
int n, a[200010], s1[200010], s2[200010], is1[200010], is2[200010];
vector<pair<int, int> > sol;
void chk_t(int t) {
  int i = 1, c1 = 0, c2 = 0, last = 0;
  while (i <= n) {
    int j1 = is1[s1[i - 1] + t];
    int j2 = is2[s2[i - 1] + t];
    if (!j1 && !j2) return;
    if (!j2 || (j1 && j1 < j2)) {
      i = j1 + 1;
      c1++;
      last = 1;
    } else {
      i = j2 + 1;
      c2++;
      last = 2;
    }
  }
  if (c1 == c2) return;
  if (c1 > c2) {
    if (last != 1) return;
    sol.push_back(make_pair(c1, t));
  } else {
    if (last != 2) return;
    sol.push_back(make_pair(c2, t));
  }
}
int main() {
  RI(n);
  for (int i = (1); i <= int(n); i++) RI(a[i]);
  for (int i = (1); i <= int(n); i++) s1[i] = s1[i - 1] + (a[i] == 1);
  for (int i = (1); i <= int(n); i++) s2[i] = s2[i - 1] + (a[i] == 2);
  for (int i = (1); i <= int(n); i++)
    if (!is1[s1[i]]) is1[s1[i]] = i;
  for (int i = (1); i <= int(n); i++)
    if (!is2[s2[i]]) is2[s2[i]] = i;
  for (int i = (1); i <= int(n); i++) chk_t(i);
  sort(begin(sol), end(sol));
  printf("%d\n", ((int)(sol).size()));
  for (auto it = (sol).begin(); it != (sol).end(); it++)
    printf("%d %d\n", it->first, it->second);
  return 0;
}
