#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
template <typename T>
void trace(T *a, int s, int n) {
  for (int i = s; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}
const long long mod = 1e9 + 7;
const int maxn = 1e6 + 5;
int n;
int a[maxn];
int acc0[maxn];
int acc1[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int winner = -1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    --a[i];
    if (a[i] == 0) {
      acc0[i]++;
    } else {
      acc1[i]++;
    }
    if (i == n - 1) winner = a[i];
  }
  for (int i = 1; i < n; i++) {
    acc0[i] += acc0[i - 1];
    acc1[i] += acc1[i - 1];
  }
  vector<pair<int, int>> ans;
  for (int t = 1; t <= n; t++) {
    int x = 0;
    int player0 = 0;
    int player1 = 0;
    while (x < n) {
      int j0 = lower_bound(acc0, acc0 + n, (x ? acc0[x - 1] : 0) + t) - acc0;
      int j1 = lower_bound(acc1, acc1 + n, (x ? acc1[x - 1] : 0) + t) - acc1;
      int end = min(j0, j1);
      if (end >= n) break;
      if (j0 < j1) {
        player0++;
      } else {
        player1++;
      }
      x = end + 1;
    }
    if (x == n) {
      if (winner == 0 && player0 > player1) {
        ans.push_back({player0, t});
      }
      if (winner == 1 && player1 > player0) {
        ans.push_back({player1, t});
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (auto p : ans) {
    cout << p.first << " " << p.second << "\n";
  }
  return 0;
}
