#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n), x(n + 1, 0), y(n + 1, 0);
  for (int i = 0; i < n; i++) cin >> a[i], a[i]--;
  x[0] = (a[0] == 0);
  y[0] = (a[0] == 1);
  for (int i = 1; i < n; i++) x[i] = x[i - 1] + (a[i] == 0);
  for (int i = 1; i < n; i++) y[i] = y[i - 1] + (a[i] == 1);
  vector<pair<int, int> > ans;
  for (int t = 1; t <= n; t++) {
    int c[2] = {0, 0}, last = -1;
    for (int i = 0; i < n;) {
      y[n] = -1, x[n] = t;
      if (i) x[n] += x[i - 1];
      int l = i, r = n;
      while (l < r) {
        int mid = l + r >> 1;
        int xx = x[mid], yy = y[mid];
        if (i) xx -= x[i - 1], yy -= y[i - 1];
        if (max(xx, yy) >= t)
          r = mid;
        else
          l = mid + 1;
      }
      if (r == n) {
        last = -1;
        break;
      }
      int xx = x[r], yy = y[r];
      if (i) xx -= x[i - 1], yy -= y[i - 1];
      if (xx == t) last = 0, c[0]++;
      if (yy == t) last = 1, c[1]++;
      i = r + 1;
    }
    if (last == -1) continue;
    if (c[0] != c[1] && c[last] == max(c[0], c[1]))
      ans.push_back(make_pair(c[last], t));
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
}
