#include <bits/stdc++.h>
using namespace std;
int s[100001];
vector<pair<int, int> > ans;
int max(int a, int b) { return a > b ? a : b; }
int main() {
  int n, i;
  scanf("%d", &n);
  s[0] = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &s[i + 1]);
    s[i + 1]--;
  }
  for (i = 0; i < n; i++) s[i + 1] += s[i];
  ans.clear();
  for (i = 1; i <= n; i++) {
    int p = 0;
    int s_a = 0;
    int s_b = 0;
    int last = 0;
    while (p < n) {
      int a = s[n] - s[p];
      int b = (n - p) - a;
      if (a < i && b < i) break;
      int l = p, r = n;
      while (r - l > 1) {
        int m = (l + r) / 2;
        a = s[m] - s[p];
        b = (m - p) - a;
        if (a < i && b < i)
          l = m;
        else
          r = m;
      }
      a = s[r] - s[p];
      b = (r - p) - a;
      if (a >= i) {
        s_a++;
        last = 0;
      }
      if (b >= i) {
        s_b++;
        last = 1;
      }
      p = r;
    }
    if (p == n && ((s_a > s_b && last == 0) || (s_a < s_b && last == 1)))
      ans.push_back(pair<int, int>(max(s_a, s_b), i));
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
