#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  long long a[n], b[n];
  long long aa = 0, bb = 0;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a[i] = aa;
    b[i] = bb;
    if (x == 1) {
      a[i]++;
      aa++;
    } else {
      b[i]++;
      bb++;
    }
  }
  set<pair<long long, long long>> ans;
  for (long long k = 1; k <= 1e5; k++) {
    long long flag = 1;
    long long sa = 0, sb = 0;
    long long a0 = 0, b0 = 0;
    long long start = 0;
    long long prev = -1;
    while (start < n) {
      long long pt1 = lower_bound(a + (prev + 1), a + n, a0 + k) - a;
      long long pt2 = lower_bound(b + (prev + 1), b + n, b0 + k) - b;
      long long pt = min(pt1, pt2);
      if (pt == n) {
        flag = 0;
        break;
      } else if (pt == n - 1) {
        if (pt1 < pt2) {
          sa++;
          if (sa > sb) {
            ans.insert({sa, k});
          }
        } else {
          sb++;
          if (sb > sa) {
            ans.insert({sb, k});
          }
        }
        break;
      } else {
        if (pt1 < pt2) {
          sa++;
        } else {
          sb++;
        }
        a0 = a[pt];
        b0 = b[pt];
        prev = pt;
      }
    }
  }
  cout << ans.size() << "\n";
  for (auto x : ans) {
    cout << x.first << " " << x.second << "\n";
  }
}
