#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int a[100005];
int psum[3][100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll i, j, k;
  int n;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    psum[1][i] = psum[1][i - 1] + (a[i] == 1);
    psum[2][i] = psum[2][i - 1] + (a[i] == 2);
  }
  vector<pair<int, int>> ans;
  int t;
  for (t = 1; t <= n; t++) {
    int x = 1;
    int c1 = 0, c2 = 0;
    for (;;) {
      int lo, hi;
      lo = x, hi = min(n, x + 2 * t - 1);
      while (lo <= hi) {
        int mid = (lo + hi) / 2;
        if (psum[1][mid] - psum[1][x - 1] >= t)
          hi = mid - 1;
        else
          lo = mid + 1;
      }
      int one = lo;
      lo = x, hi = min(n, x + 2 * t - 1);
      while (lo <= hi) {
        int mid = (lo + hi) / 2;
        if (psum[2][mid] - psum[2][x - 1] >= t)
          hi = mid - 1;
        else
          lo = mid + 1;
      }
      int two = lo;
      if (one > n && two > n) break;
      int mn = min(one, two);
      if (mn == one)
        c1++;
      else
        c2++;
      if (mn == n) {
        if ((mn == one && c1 > c2) || (mn == two && c1 < c2))
          ans.push_back({max(c1, c2), t});
        break;
      }
      x = mn + 1;
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << '\n';
  for (auto x : ans) cout << x.first << ' ' << x.second << '\n';
}
