#include <bits/stdc++.h>
using namespace std;
void yesno(bool a) {
  if (a) {
    cout << "YES" << '\n';
  } else {
    cout << "NO" << '\n';
  }
}
long long power(long long x, long long n, long long m) {
  if (n == 0) return 1;
  long long u = power(x, n / 2, m);
  u = (u * u) % m;
  if (n % 2) u = (u * x) % m;
  return u;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int pref[n + 1][2];
  int i;
  pref[0][0] = 0;
  pref[0][1] = 0;
  int arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    pref[i + 1][0] = pref[i][0];
    pref[i + 1][1] = pref[i][1];
    arr[i]--;
    pref[i + 1][arr[i]]++;
  }
  set<pair<int, int> > ans;
  if (arr[n - 1] == 1) {
    for (i = 1; i <= n; i++) {
      swap(pref[i][0], pref[i][1]);
      arr[i - 1] ^= 1;
    }
  }
  for (int t = 1; t <= pref[n][0]; t++) {
    int p0 = 0;
    int p1 = 0;
    int p0w = 0;
    int p1w = 0;
    int pos = 0;
    bool flag = true;
    while (pos < n) {
      int l = pos, r = n - 1;
      int ch = -1;
      while (l <= r) {
        int mid = (l + r) / 2;
        int one = pref[mid + 1][1] - p1;
        int zero = pref[mid + 1][0] - p0;
        if (one >= t || zero >= t) {
          ch = mid;
          r = mid - 1;
        } else
          l = mid + 1;
      }
      if (ch == -1) {
        flag = false;
        break;
      }
      pos = ch;
      int one = pref[pos + 1][1] - p1;
      int zero = pref[pos + 1][0] - p0;
      if (one == t)
        p1w++;
      else
        p0w++;
      p1 += one;
      p0 += zero;
      pos++;
    }
    if (pos == n && p0w > p1w) {
      ans.insert({p0w, t});
    }
  }
  cout << ans.size() << '\n';
  for (auto x : ans) cout << x.first << " " << x.second << '\n';
}
