#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using dd = long double;
namespace {
static bool constexpr dbg = 0;
ll constexpr N = 2.1e5, INF = LONG_LONG_MAX / 4;
ll n, d[N + 9], n1, n2, c1[N + 9], c2[N + 9], l1[N + 9], l2[N + 9];
void init() {
  cin >> n;
  for (ll i = 1, ii_ = (n); i <= ii_; ++i) cin >> d[i];
}
void solve() {
  for (ll i = 0, ii_ = (N); i < ii_; ++i) c1[i] = c2[i] = INF;
  for (ll i = 1, ii_ = (n); i <= ii_; ++i) {
    if (d[i] == 1)
      ++n1, c1[n1] = i;
    else
      ++n2, c2[n2] = i;
    l1[i] = l1[i - 1] + (d[i] == 1);
    l2[i] = l2[i - 1] + (d[i] == 2);
  }
  ll cnt = 0;
  vector<pll> res;
  for (ll t = 1, ii_ = (n); t <= ii_; ++t) {
    ll s1, s2, w1, w2;
    s1 = s2 = w1 = w2 = 0;
    while (s1 <= n1 && s2 <= n2) {
      if (c1[s1 + t] == INF && c2[s2 + t] == INF) break;
      if (c1[s1 + t] < c2[s2 + t]) {
        ++w1;
        s1 += t;
        s2 = l2[c1[s1]];
      } else if (c2[s2 + t] < c1[s1 + t]) {
        ++w2;
        s2 += t;
        s1 = l1[c2[s2]];
      }
    }
    if (d[n] == 1 && s1 == n1 && w1 > w2) {
      ++cnt;
      res.emplace_back(w1, t);
    } else if (d[n] == 2 && s2 == n2 && w2 > w1) {
      ++cnt;
      res.emplace_back(w2, t);
    }
  }
  cout << cnt << '\n';
  sort(res.begin(), res.end());
  for (auto ch : res) cout << ch.first << ' ' << ch.second << '\n';
}
}  // namespace
int main() {
  if (!dbg) {
    std::ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  cout << fixed << setprecision(20);
  init();
  solve();
  return 0;
}
