#include <bits/stdc++.h>
using namespace std;
int a[200009];
int s1[200009];
int s2[200009];
int id1[200009];
int id2[200009];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 2 * n; ++i) id1[i] = -1;
  for (int i = 1; i <= 2 * n; ++i) id2[i] = -1;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (i > 0) {
      s1[i] += s1[i - 1];
      s2[i] += s2[i - 1];
    }
    if (a[i] == 1)
      s1[i]++;
    else
      s2[i]++;
    if (id1[s1[i]] == -1) id1[s1[i]] = i;
    if (id2[s2[i]] == -1) id2[s2[i]] = i;
  }
  vector<pair<int, int> > ans;
  for (int t = 1; t <= max(s1[n - 1], s2[n - 1]); ++t) {
    int ans1 = 0, ans2 = 0;
    int i = 0;
    bool f = false;
    while (i < n) {
      int i1, i2;
      if (s1[i] + t - (a[i] == 1) > s1[n - 1])
        i1 = n;
      else {
        if (a[i] == 1)
          i1 = id1[s1[i] + t - 1];
        else
          i1 = id1[s1[i] + t];
      }
      if (s2[i] + t - (a[i] == 2) > s2[n - 1])
        i2 = n;
      else {
        if (a[i] == 2)
          i2 = id2[s2[i] + t - 1];
        else
          i2 = id2[s2[i] + t];
      }
      if (i1 == n && i2 == n) {
        f = false;
        break;
      }
      f = false;
      if (i1 < i2) {
        ++ans1;
        if (ans1 > ans2) f = true;
      } else {
        ++ans2;
        if (ans2 > ans1) f = true;
      }
      i = min(i1, i2) + 1;
    }
    if (f && ans1 != ans2) {
      ans.push_back(make_pair(max(ans1, ans2), t));
    }
  }
  sort(ans.begin(), ans.end());
  cout << (int)ans.size() << endl;
  for (int i = 0; i < (int)ans.size(); ++i)
    cout << ans[i].first << ' ' << ans[i].second << '\n';
}
