#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int MAX = 2e5 + 5;
const long long MAX2 = 11;
const long long MOD = 1000000007;
const long long MOD2 = 1000005329;
const long long INF = 2e18;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1, 0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 2000;
int n, x[MAX], y[MAX], px[MAX], py[MAX], a, b, c, idx, idy, cx, cy;
bool st;
vector<pair<int, int> > ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> c;
    if (c == 1)
      x[++a] = i, px[i] = a;
    else
      y[++b] = i, py[i] = b;
  }
  for (int i = 1; i <= 200000; ++i) {
    if (!px[i]) px[i] = px[i - 1];
    if (!py[i]) py[i] = py[i - 1];
  }
  for (int jmp = 1; jmp <= n; ++jmp) {
    idx = idy = cx = cy = 0;
    while (1) {
      if (!x[idx + jmp] && !y[idy + jmp]) break;
      if (!x[idx + jmp]) {
        idy += jmp;
        idx = px[y[idy]];
        ++cy;
        st = 1;
      } else if (!y[idy + jmp]) {
        idx += jmp;
        idy = py[x[idx]];
        ++cx;
        st = 0;
      } else if (x[idx + jmp] < y[idy + jmp]) {
        idx += jmp;
        idy = py[x[idx]];
        ++cx;
        st = 0;
      } else {
        idy += jmp;
        idx = px[y[idy]];
        ++cy;
        st = 1;
      }
      if (x[idx] == n || y[idy] == n) {
        if (cx > cy && !st) ans.push_back({cx, jmp});
        if (cy > cx && st) ans.push_back({cy, jmp});
        break;
      }
    }
  }
  cout << ans.size() << '\n';
  sort(ans.begin(), ans.end());
  for (auto i : ans) cout << i.first << ' ' << i.second << '\n';
  return 0;
}
