#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  vector<int> uno(n + 1, 0);
  vector<int> dos(n + 1, 0);
  for (int i = 0; i < n; i++) {
    uno[i + 1] = uno[i];
    dos[i + 1] = dos[i];
    if (v[i] == 1) {
      uno[i + 1] += 1;
    } else {
      dos[i + 1] += 1;
    }
  }
  vector<pair<int, int> > resp;
  for (int i = 1; i <= n; i++) {
    int unos = 0, doss = 0;
    int nextSet = 0;
    while (nextSet < n) {
      int lo = nextSet + 1;
      int hi = min(lo + (2 * i), n);
      while (hi > lo) {
        int mid = (hi + lo) / 2;
        if (uno[mid] - uno[nextSet] >= i or dos[mid] - dos[nextSet] >= i) {
          hi = mid;
        } else {
          lo = mid + 1;
        }
      }
      if (uno[lo] - uno[nextSet] == i) {
        unos++;
      } else if (dos[lo] - dos[nextSet] == i) {
        doss++;
      } else {
        break;
      }
      nextSet = lo;
    }
    if (nextSet == n) {
      if (v[n - 1] == 1 and unos > doss) {
        resp.push_back(make_pair(unos, i));
      }
      if (v[n - 1] == 2 and doss > unos) {
        resp.push_back(make_pair(doss, i));
      }
    }
  }
  sort(resp.begin(), resp.end());
  cout << resp.size() << "\n";
  for (auto aa : resp) {
    cout << aa.first << ' ' << aa.second << "\n";
  }
  return 0;
}
