#include <bits/stdc++.h>
using namespace std;
const int N = 100003;
int n, w1, w2, p1, p2, c1, c2, np1, np2;
vector<pair<int, int> > pos1, pos2, ans;
int main() {
  scanf("%d", &n);
  int t, s, winn;
  c1 = c2 = 0;
  pos1.push_back(pair<int, int>(-1, -1));
  pos2.push_back(pair<int, int>(-1, -1));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t);
    if (t == 1)
      pos1.push_back(pair<int, int>(i, c2)), c1++;
    else
      pos2.push_back(pair<int, int>(i, c1)), c2++;
    if (i == n) winn = t;
  }
  for (t = 1; t <= n; t++) {
    p1 = p2 = 0;
    w1 = w2 = 0;
    bool valid = true;
    while (p1 < c1 || p2 < c2) {
      if (p1 + t > c1)
        np1 = N;
      else
        np1 = pos1[p1 + t].first;
      if (p2 + t > c2)
        np2 = N;
      else
        np2 = pos2[p2 + t].first;
      if (np1 == N && np2 == N) {
        valid = false;
        break;
      }
      if (np1 < np2) {
        w1++;
        p2 = pos1[p1 + t].second;
        p1 += t;
      } else {
        w2++;
        p1 = pos2[p2 + t].second;
        p2 += t;
      }
      if (p1 == c1 && p2 == c2) break;
    }
    if (winn == 1 && w1 <= w2)
      valid = false;
    else if (winn == 2 && w2 <= w1)
      valid = false;
    if (valid) ans.push_back(pair<int, int>(max(w1, w2), t));
  }
  sort(ans.begin(), ans.end());
  printf("%lu\n", ans.size());
  for (pair<int, int> e : ans) printf("%d %d\n", e.first, e.second);
  return 0;
}
