#include <bits/stdc++.h>
using namespace std;
const int N = 4e6 + 50;
int freqA[N], freqB[N];
int accA[N], accB[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, x;
  cin >> n;
  memset(freqA, 63, sizeof freqA);
  memset(freqB, 63, sizeof freqB);
  int A = 0, B = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (x == 1) {
      A++;
      freqA[A] = i;
    } else {
      B++;
      freqB[B] = i;
    }
    accA[i] = A;
    accB[i] = B;
  }
  vector<pair<int, int> > valid;
  for (int i = 1; i <= n; i++) {
    int curPos = 0, pAccA = 0, pAccB = 0, nextPos, wonA = 0, wonB = 0;
    while (curPos < n) {
      pAccA = accA[curPos];
      pAccB = accB[curPos];
      int posA = freqA[pAccA + i];
      int posB = freqB[pAccB + i];
      if (posA < posB) {
        wonA++;
        curPos = posA;
      } else {
        wonB++;
        curPos = posB;
      }
    }
    if (curPos == n) {
      if (wonA != wonB) {
        if (x == 1 && wonA > wonB) {
          valid.push_back(pair<int, int>(wonA, i));
        }
        if (x == 2 && wonB > wonA) {
          valid.push_back(pair<int, int>(wonB, i));
        }
      }
    }
  }
  sort(valid.begin(), valid.end());
  cout << valid.size() << endl;
  for (int i = 0; i < valid.size(); i++) {
    cout << valid[i].first << " " << valid[i].second << '\n';
  }
  return 0;
}
