#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int ps1[100005], ps2[100005], pw1[100005], pw2[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int i, j, k, l, m, n, t, r, cnt;
  int flag = 0;
  long long ans = 0, an = 0;
  int t1 = 1;
  while (t1--) {
    cin >> n;
    for (i = 1; i <= n; i++) {
      cin >> a[i];
      ps1[i] = ps1[i - 1];
      ps2[i] = ps2[i - 1];
      if (a[i] == 1) {
        ps1[i]++;
      } else {
        ps2[i]++;
      }
    }
    vector<pair<int, int> > v;
    for (t = 1; t <= n; t++) {
      int curr = 0;
      int flag = 0;
      int cnt = 0;
      pw1[0] = pw2[0] = 0;
      while (1) {
        int id1 = lower_bound(ps1 + 1, ps1 + n + 1, ps1[curr] + t) - ps1;
        int id2 = lower_bound(ps2 + 1, ps2 + n + 1, ps2[curr] + t) - ps2;
        curr = min(id1, id2);
        if (cnt) {
          pw1[cnt] = pw1[cnt - 1];
          pw2[cnt] = pw2[cnt - 1];
        }
        if (id1 < id2) {
          pw1[cnt]++;
        } else {
          pw2[cnt]++;
        }
        cnt++;
        if (curr == n) {
          flag = 1;
          break;
        } else if (curr > n) {
          break;
        }
      }
      int val;
      if (pw1[cnt - 1] > pw2[cnt - 1]) {
        if (cnt > 1 && pw1[cnt - 2] == pw1[cnt - 1]) {
          flag = 0;
        }
      } else {
        if (cnt > 1 && pw2[cnt - 2] == pw2[cnt - 1]) {
          flag = 0;
        }
      }
      if (flag == 1 && pw1[cnt - 1] != pw2[cnt - 1]) {
        v.push_back(make_pair(max(pw1[cnt - 1], pw2[cnt - 1]), t));
      }
    }
    sort(v.begin(), v.end());
    cout << (int)v.size() << endl;
    for (i = 0; i < v.size(); i++) {
      cout << v[i].first << " " << v[i].second << endl;
    }
  }
}
