#include <bits/stdc++.h>
using namespace std;
int fs[100100], sc[100100];
int fssum[100100], scsum[100100];
int n;
int getsum(int l, int r, int* sum) {
  if (l == 0)
    return (r == 0) ? 0 : sum[r - 1];
  else
    return sum[r - 1] - sum[l - 1];
}
int roundEnd(int start, int t) {
  int l = start, r = n + 1;
  if (getsum(start, n, fssum) < t && getsum(start, n, scsum) < t) return -1;
  while (l + 1 < r) {
    int m = (l + r) / 2;
    int sum1 = getsum(start, m, fssum);
    int sum2 = getsum(start, m, scsum);
    if ((sum1 == t && sum2 == t) || sum1 > t || sum2 > t ||
        (sum1 == t && fs[m - 1] != 1) || (sum2 == t && sc[m - 1] != 1))
      r = m;
    else
      l = m;
  }
  return l;
}
int roundRes(int start, int end) {
  if (getsum(start, end, scsum) > getsum(start, end, fssum))
    return 1;
  else
    return 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  memset(fs, 0, sizeof fs);
  memset(sc, 0, sizeof sc);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      fs[i] = 1;
    } else {
      sc[i] = 1;
    }
  }
  fssum[0] = fs[0];
  scsum[0] = sc[0];
  for (int i = 1; i < n; i++) {
    fssum[i] = fssum[i - 1] + fs[i];
    scsum[i] = scsum[i - 1] + sc[i];
  }
  vector<pair<int, int>> ans;
  for (int t = 1; t <= n; t++) {
    bool valid = true;
    int fss = 0, scs = 0, lres;
    for (int i = 0; i < n; i = roundEnd(i, t)) {
      int end = roundEnd(i, t);
      if (end == -1) {
        valid = false;
        break;
      } else {
        if ((lres = roundRes(i, end)) == 1)
          fss++;
        else
          scs++;
      }
    }
    if (lres == 2 && fss >= scs) valid = false;
    if (lres == 1 && scs >= fss) valid = false;
    if (!valid || fss == scs) continue;
    ans.push_back(make_pair(max(fss, scs), t));
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
}
