#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int A[maxn], a[maxn], b[maxn];
vector<pair<int, int> > ans;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 1; i <= n; i++) {
    a[i] = a[i - 1], b[i] = b[i - 1];
    if (A[i - 1] == 1)
      a[i]++;
    else
      b[i]++;
  }
  for (int t = 1; t <= n; t++) {
    int l = 0, w1 = 0, w2 = 0, can = 1, lst = 0;
    while (l < n && can) {
      int lo = l, hi = n + 1;
      while (hi - lo > 1) {
        int mid = (hi + lo) / 2;
        int t1 = a[mid] - a[l];
        int t2 = b[mid] - b[l];
        if (t1 >= t || t2 >= t)
          hi = mid;
        else
          lo = mid;
      }
      if (hi == n + 1) {
        can = 0;
        break;
      }
      if (a[hi] - a[l] > b[hi] - b[l])
        w1++, lst = 1;
      else
        w2++, lst = 2;
      l = hi;
    }
    if (!can || w1 == w2 || l != n) continue;
    if ((w1 > w2 && lst == 2) || (w2 > w1 && lst == 1)) continue;
    ans.push_back({max(w1, w2), t});
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << '\n';
  for (pair<int, int> t : ans) cout << t.first << " " << t.second << '\n';
}
