#include <bits/stdc++.h>
using namespace std;
int n;
int a[100100];
int s0[100100];
int s1[100100];
vector<pair<int, int> > res;
int TK1(int x, int tt) {
  int l = x + 1;
  int r = n;
  int res = -1;
  while (l <= r) {
    int m = (l + r) / 2;
    if (tt == s1[m] - s1[x]) {
      res = m;
      r = m - 1;
    } else if (tt < s1[m] - s1[x])
      r = m - 1;
    else
      l = m + 1;
  }
  return res;
}
int TK2(int x, int tt) {
  int l = x + 1;
  int r = n;
  int res = -1;
  while (l <= r) {
    int m = (l + r) / 2;
    if (tt == s0[m] - s0[x]) {
      res = m;
      r = m - 1;
    } else if (tt < s0[m] - s0[x])
      r = m - 1;
    else
      l = m + 1;
  }
  return res;
}
bool cmp(pair<int, int> u, pair<int, int> v) {
  return (u.first < v.first || ((u.first == v.first) && (u.second < v.second)));
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s0[i] = s0[i - 1] + (a[i] == 2);
    s1[i] = s1[i - 1] + (a[i] == 1);
  }
  for (int t = 1; t <= n; t++) {
    int p1 = 0;
    int p2 = 0;
    int ans1, ans2;
    int pos = 0;
    bool co = true;
    int last = -1;
    while (true) {
      ans1 = TK1(pos, t);
      ans2 = TK2(pos, t);
      if (ans1 == -1 && ans2 == -1) {
        co = false;
        break;
      }
      if (ans1 == -1) {
        p2++;
        last = 2;
        pos = ans2;
      } else if (ans2 == -1) {
        p1++;
        last = 1;
        pos = ans1;
      } else {
        if (ans1 < ans2) {
          p1++;
          last = 1;
          pos = ans1;
        } else {
          p2++;
          last = 2;
          pos = ans2;
        }
      }
      if (pos == n) break;
    }
    if (co) {
      if (a[n] == 1 && p1 > p2) res.push_back(make_pair(p1, t));
      if (a[n] == 2 && p2 > p1) res.push_back(make_pair(p2, t));
    }
  }
  sort(res.begin(), res.end(), cmp);
  cout << res.size() << "\n";
  for (int i = 0; i < res.size(); i++)
    cout << res[i].first << " " << res[i].second << "\n";
  return 0;
}
