#include <bits/stdc++.h>
using namespace std;
struct state {
  int v, a, b, prev;
};
int N;
int sum1[100010], sum2[100010];
vector<state> vec[100010];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    int get;
    cin >> get;
    if (get == 1)
      sum1[i + 1]++;
    else
      sum2[i + 1]++;
    sum1[i + 1] += sum1[i];
    sum2[i + 1] += sum2[i];
  }
  sum1[N + 1] = (1 << 28);
  sum2[N + 1] = (1 << 28);
  for (int i = 1; i <= N; i++) vec[0].push_back(state{i, 0, 0, 0});
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < vec[i].size(); j++) {
      state s = vec[i][j];
      int a = lower_bound(sum1, sum1 + N + 1, sum1[i] + s.v) - sum1;
      int b = lower_bound(sum2, sum2 + N + 1, sum2[i] + s.v) - sum2;
      if (a < b) vec[a].push_back(state{s.v, s.a + 1, s.b, 0});
      if (a > b) vec[b].push_back(state{s.v, s.a, s.b + 1, 1});
    }
  }
  vector<pair<int, int> > ans;
  for (int i = 0; i < vec[N].size(); i++) {
    if (vec[N][i].a != vec[N][i].b) {
      if (vec[N][i].a > vec[N][i].b && vec[N][i].prev == 1) continue;
      if (vec[N][i].a < vec[N][i].b && vec[N][i].prev == 0) continue;
      ans.push_back(pair<int, int>(max(vec[N][i].a, vec[N][i].b), vec[N][i].v));
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
}
