#include <bits/stdc++.h>
using namespace std;
const int maxn = 101010;
int n, a[maxn], s1[maxn], s2[maxn];
vector<pair<int, int> > ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s1[i] = s1[i - 1] + (a[i] == 1);
    s2[i] = s2[i - 1] + (a[i] == 2);
  }
  for (int t = 1; t <= n; t++) {
    int v = 1, p1 = 0, p2 = 0, last, pos, l, r, mid;
    while (v <= n) {
      l = v, r = n, pos = -1;
      while (l <= r) {
        mid = (l + r) >> 1;
        if (s1[mid] - s1[v - 1] >= t || s2[mid] - s2[v - 1] >= t) {
          pos = mid;
          r = mid - 1;
        } else
          l = mid + 1;
      }
      if (pos == -1) break;
      if (s1[pos] - s1[v - 1] == t) {
        p1++;
        last = 1;
      } else {
        p2++;
        last = 2;
      }
      v = pos + 1;
    }
    if (v < n + 1) continue;
    if (a[n] == 1 && last == 1 && p1 > p2) ans.push_back(make_pair(p1, t));
    if (a[n] == 2 && last == 2 && p1 < p2) ans.push_back(make_pair(p2, 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 << endl;
  return 0;
}
