#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
  os << "{";
  for (int(i) = 0; (i) < int(t.size()); ++(i)) {
    os << t[i] << ",";
  }
  os << "}" << endl;
  return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
  return os << "(" << t.first << "," << t.second << ")";
}
vector<int> st[2][112345];
int sum[2][112345];
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(0);
  int i, j, k;
  int n, INF = 1e7;
  cin >> n;
  vector<int> a(n);
  for (int(i) = 0; (i) < int(n); ++(i)) cin >> a[i];
  for (int(i) = 0; (i) < int(n); ++(i)) {
    for (int(j) = 0; (j) < int(2); ++(j)) sum[j][i + 1] = sum[j][i];
    sum[a[i] - 1][i + 1]++;
  }
  for (int(i) = 0; (i) < int(n + 1); ++(i))
    for (int(j) = 0; (j) < int(2); ++(j)) st[j][sum[j][i]].push_back(i);
  for (int(i) = 0; (i) < int(112345); ++(i))
    for (int(j) = 0; (j) < int(2); ++(j)) st[j][i].push_back(INF);
  vector<pair<int, int> > re;
  for (int s = 1; s <= n; s++) {
    int last = 0, cnt = 0, d = 0;
    for (;; cnt++) {
      int aw = sum[0][last] + s, bw = sum[1][last] + s;
      if (max(aw, bw) > n) break;
      int al = *lower_bound((st[0][aw]).begin(), (st[0][aw]).end(), last),
          bl = *lower_bound((st[1][bw]).begin(), (st[1][bw]).end(), last);
      if (al < bl) {
        d++;
        last = al;
      } else {
        d--;
        last = bl;
      }
      if (last > n) {
        break;
      } else if (last == n) {
        if (1ll * d * (bl - al) > 0)
          re.push_back(pair<int, int>((cnt + 1 + abs(d)) / 2, s));
        break;
      }
    }
  }
  sort((re).begin(), (re).end());
  cout << re.size() << endl;
  for (int(i) = 0; (i) < int(re.size()); ++(i))
    cout << re[i].first << " " << re[i].second << endl;
  return 0;
}
