#include <bits/stdc++.h>
using namespace std;
long long dp[200100][2];
long long vv[200100][2];
int a[100100];
long long n;
void solve(int tt) {
  long long p = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == tt) {
      dp[p][tt - 1] = i;
      p++;
    }
  }
}
void xxx(int tt) {
  long long tot = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == tt) {
      tot++;
    }
    vv[i][tt - 1] = tot;
  }
}
vector<pair<long long, long long> > sol;
long long ddd(int t) {
  long long tot = 0;
  long long h = 0;
  long long h1 = 0;
  long long h2 = 0;
  long long win1 = 0;
  long long win2 = 0;
  long long last = 0;
  do {
    long long p = dp[h1 + t][0];
    long long k = dp[h2 + t][1];
    if (p != 0 && k != 0) {
      h = min(k, p);
      if (k < p) {
        win2++;
        last = 2;
      } else {
        win1++;
        last = 1;
      }
    } else if (p == 0 && k != 0) {
      h = k;
      win2++;
      last = 2;
    } else if (k == 0 && p != 0) {
      h = p;
      win1++;
      last = 1;
    } else {
      return -1;
    }
    h1 = vv[h][0];
    h2 = vv[h][1];
    tot++;
    if (tot > n) return -1;
  } while (h != n);
  if (win1 == win2) return -1;
  if (win1 > win2 && last != 1) return -1;
  if (win2 > win1 && last != 2) return -1;
  return max(win1, win2);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  solve(1);
  solve(2);
  xxx(1);
  xxx(2);
  for (int i = 1; i <= n; i++) {
    long long b = ddd(i);
    if (b != -1) {
      sol.push_back(make_pair(b, i));
    }
  }
  sort(sol.begin(), sol.end());
  cout << sol.size() << endl;
  for (int i = 0; i < sol.size(); i++) {
    cout << sol[i].first << " " << sol[i].second << endl;
  }
}
