#include <bits/stdc++.h>
using namespace std;
inline bool checkBit(long long n, int i) { return n & (1LL << i); }
inline long long setBit(long long n, int i) {
  return n | (1LL << i);
  ;
}
inline long long resetBit(long long n, int i) { return n & (~(1LL << i)); }
inline bool EQ2(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-7; }
vector<int> a, b;
vector<int> score[101000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  a.assign(n, 0);
  b.assign(n, 0);
  for (int i = 0; i < n; ++i) {
    int temp;
    cin >> temp;
    a[i] = temp == 1;
    b[i] = temp == 2;
    if (i - 1 >= 0) a[i] += a[i - 1], b[i] += b[i - 1];
  }
  for (int t = 1; t <= n; ++t) {
    int cur = 0;
    int ascore = 0, bscore = 0, awin = 0, bwin = 0;
    while (1) {
      auto it1 = lower_bound(a.begin() + cur, a.end(), ascore + t);
      auto it2 = lower_bound(b.begin() + cur, b.end(), bscore + t);
      int ai = distance(a.begin(), it1);
      int bi = distance(b.begin(), it2);
      if (ai < bi) {
        ++awin;
        ascore = a[ai];
        bscore = b[ai];
        cur = ai + 1;
        if (ai == n - 1) {
          if (awin - bwin > 0) {
            score[awin].push_back(t);
          }
          break;
        }
      } else if (bi < ai) {
        ++bwin;
        ascore = a[bi];
        bscore = b[bi];
        cur = bi + 1;
        if (bi == n - 1) {
          if (bwin - awin > 0) {
            score[bwin].push_back(t);
          }
          break;
        }
      }
      if (ai == bi) {
        break;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    ans += score[i].size();
  }
  cout << ans << '\n';
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j < score[i].size(); ++j)
      cout << i << " " << score[i][j] << '\n';
  }
  return 0;
}
