#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
pii val;
vector<pii> segTree;
void setval(pii val, int pos, int a, int b, int curr);
void getval(pii need, int a, int b, int curr);
pii sum(pii a, pii b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n, lastpos;
  cin >> n;
  segTree.resize(4 * (n + 1) + 1);
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    lastpos = x;
    if (x == 1) {
      setval({1, 0}, i, 1, n, 1);
    } else {
      setval({0, 1}, i, 1, n, 1);
    }
  }
  vector<pii> sol;
  for (int t = 1; t <= n; ++t) {
    pii s = {0, 0}, score = {0, 0};
    int lastwinner;
    bool good = true;
    while (score.first + score.second != n) {
      val = {0, 0};
      getval(sum(score, make_pair(t, t)), 1, n, 1);
      if (val.first - score.first == t) {
        ++s.first;
        lastwinner = 1;
      } else if (val.second - score.second == t) {
        ++s.second;
        lastwinner = 2;
      } else {
        good = false;
        break;
      }
      score = val;
    }
    if (s.first > s.second && (lastpos != 1 || lastwinner != 1)) {
      good = false;
    }
    if (s.second > s.first && (lastpos != 2 || lastwinner != 2)) {
      good = false;
    }
    if (good && s.first != s.second) {
      sol.push_back({max(s.first, s.second), t});
    }
  }
  cout << sol.size() << "\n";
  sort(sol.begin(), sol.end());
  for (auto it : sol) {
    cout << it.first << " " << it.second << "\n";
  }
  return 0;
}
void setval(pii val, int pos, int a, int b, int curr) {
  if (a == b) {
    segTree[curr] = sum(segTree[curr], val);
    return;
  }
  int mid = (a + b) / 2;
  if (pos <= mid) {
    setval(val, pos, a, mid, 2 * curr);
  } else {
    setval(val, pos, mid + 1, b, 2 * curr + 1);
  }
  segTree[curr] = sum(segTree[2 * curr], segTree[2 * curr + 1]);
}
void getval(pii need, int a, int b, int curr) {
  if (a == b) {
    val = sum(val, segTree[curr]);
    return;
  }
  int mid = (a + b) / 2;
  pii p = sum(val, segTree[2 * curr]);
  if (p.first >= need.first || p.second >= need.second) {
    getval(need, a, mid, 2 * curr);
  } else {
    val = sum(val, segTree[2 * curr]);
    getval(need, mid + 1, b, 2 * curr + 1);
  }
}
