#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<long long> v(n);
  vector<long long> v1(n, 0);
  vector<long long> v2(n, 0);
  long long c1 = 0;
  long long c2 = 0;
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
    if (v[i] == 1)
      c1++;
    else
      c2++;
    v1[i] = c1;
    v2[i] = c2;
  }
  vector<pair<long long, long long> > ans;
  for (long long j = 0; j < n; j++) {
    if ((v1[j] > v2[j]) && (j > 0 ? v1[j] != v1[j - 1] : 1)) {
      long long t = v1[j];
      long long cur = j;
      long long c1 = 1;
      long long c2 = 0;
      while (1) {
        if (cur == n - 1) {
          if (c1 > c2 && v[cur] != 1) break;
          if (c2 > c1 && v[cur] != 2) break;
          if (c1 == c2)
            ;
          else
            ans.push_back(make_pair(max(c1, c2), t));
        }
        vector<long long>::iterator it1 =
            lower_bound(v1.begin(), v1.end(), v1[cur] + t);
        vector<long long>::iterator it2 =
            lower_bound(v2.begin(), v2.end(), v2[cur] + t);
        if (it1 == v1.end() && it2 == v2.end()) {
          break;
        }
        if (it1 != v1.end() && it2 != v2.end()) {
          if (it1 - v1.begin() < it2 - v2.begin()) {
            c1++;
            cur = it1 - v1.begin();
          } else {
            c2++;
            cur = it2 - v2.begin();
          }
        } else if (it1 == v1.end()) {
          cur = it2 - v2.begin();
          c2++;
        } else {
          cur = it1 - v1.begin();
          c1++;
        }
      }
    } else if ((v2[j] > v1[j]) && (j > 0 ? v2[j] != v2[j - 1] : 1)) {
      long long t = v2[j];
      long long cur = j;
      long long c1 = 0;
      long long c2 = 1;
      while (1) {
        if (cur == n - 1) {
          if (c1 > c2 && v[cur] != 1) break;
          if (c2 > c1 && v[cur] != 2) break;
          if (c1 == c2)
            ;
          else
            ans.push_back(make_pair(max(c1, c2), t));
        }
        vector<long long>::iterator it1 =
            lower_bound(v1.begin(), v1.end(), v1[cur] + t);
        vector<long long>::iterator it2 =
            lower_bound(v2.begin(), v2.end(), v2[cur] + t);
        if (it1 == v1.end() && it2 == v2.end()) {
          break;
        }
        if (it1 != v1.end() && it2 != v2.end()) {
          if (it1 - v1.begin() < it2 - v2.begin()) {
            c1++;
            cur = it1 - v1.begin();
          } else {
            c2++;
            cur = it2 - v2.begin();
          }
        } else if (it1 == v1.end()) {
          cur = it2 - v2.begin();
          c2++;
        } else {
          cur = it1 - v1.begin();
          c1++;
        }
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << "\n";
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
  return 0;
}
