#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> A(n + 1);
  for (int i = 0; i < (n); i++) cin >> A[i + 1];
  vector<int> P1(n + 1);
  vector<int> P2(n + 1);
  for (int i = 1; i <= n; i++) {
    P1[i] = P1[i - 1];
    P2[i] = P2[i - 1];
    if (A[i] == 1)
      P1[i]++;
    else
      P2[i]++;
  }
  vector<pair<int, int>> rj{};
  for (int t = 1; t <= n; t++) {
    int ending = 0;
    int s1 = 0;
    int s2 = 0;
    int last = 1;
    int p1 = 0;
    int p2 = 0;
    bool succ = true;
    while (ending <= n) {
      int e1 = lower_bound(P1.begin(), P1.end(), p1 + t) - P1.begin();
      int e2 = lower_bound(P2.begin(), P2.end(), p2 + t) - P2.begin();
      ending = min(e1, e2);
      if (ending == n + 1) {
        succ = false;
        break;
      }
      p1 = P1[ending];
      p2 = P2[ending];
      if (e1 < e2) {
        s1++;
        last = 1;
      } else {
        s2++;
        last = 2;
      }
      ending++;
    }
    if (succ) {
      if ((s1 > s2 && last == 1) || (s2 > s1 && last == 2)) {
        rj.push_back(make_pair((max(s1, s2)), (t)));
      }
    }
  }
  sort(rj.begin(), rj.end());
  cout << rj.size() << endl;
  for (pair<int, int> p : rj) {
    cout << p.first << " " << p.second << endl;
  }
}
