#include <bits/stdc++.h>
using namespace std;
int n, a[400005], d1[400005], d2[400005], f1[400005], f2[400005];
vector<pair<int, int> > ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1, ca = 0, cb = 0; i <= n; ++i) {
    f1[i] = f1[i - 1];
    f2[i] = f2[i - 1];
    if (a[i] == 1)
      d1[++ca] = i, ++f1[i];
    else
      d2[++cb] = i, ++f2[i];
  }
  for (int t = 1; t <= n; t++) {
    int i = 1, sa = 0, sb = 0;
    pair<int, int> tmp;
    for (; i <= n;) {
      int j1 = d1[tmp.first + t];
      int j2 = d2[tmp.second + t];
      if (j1 == 0) j1 = n + 1;
      if (j2 == 0) j2 = n + 1;
      if (j1 > n && j2 > n) break;
      if (j1 < j2) {
        ++sa;
        i = j1 + 1;
        tmp.first += t;
        tmp.second = f2[j1];
      } else {
        ++sb;
        i = j2 + 1;
        tmp.first = f1[j2];
        tmp.second += t;
      }
    }
    if (i > n) {
      if (sa > sb && a[n] == 1)
        ans.push_back(make_pair(sa, t));
      else if (sa < sb && a[n] == 2)
        ans.push_back(make_pair(sb, t));
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << '\n';
  for (int i = 0; i < ans.size(); ++i)
    cout << ans[i].first << ' ' << ans[i].second << '\n';
}
