#include <bits/stdc++.h>
using namespace std;
int n;
int a1[100010];
int a2[100010];
vector<pair<int, int> > ans;
int check(int t) {
  int w1 = 0, w2 = 0;
  int p = 0;
  int last;
  while (p != n) {
    int beg = p + 1, end = n;
    int p1, p2;
    int mid;
    while (1) {
      mid = (beg + end) / 2;
      if (a1[mid] - a1[p] < t)
        beg = mid + 1;
      else if (a1[mid] - a1[p] > t ||
               (a1[mid] - a1[p] == t && a1[mid] - a1[mid - 1] == 0))
        end = mid - 1;
      else {
        p1 = mid;
        break;
      }
      if (beg > end) {
        p1 = 1000000000;
        break;
      }
    }
    beg = p + 1, end = n;
    while (1) {
      mid = (beg + end) / 2;
      if (a2[mid] - a2[p] < t)
        beg = mid + 1;
      else if (a2[mid] - a2[p] > t ||
               (a2[mid] - a2[p] == t && a2[mid] - a2[mid - 1] == 0))
        end = mid - 1;
      else {
        p2 = mid;
        break;
      }
      if (beg > end) {
        p2 = 1000000000;
        break;
      }
    }
    if (p1 == 1000000000 && p2 == 1000000000) return -1;
    if (p1 < p2)
      p = p1, w1++, last = 1;
    else
      p = p2, w2++, last = 2;
  }
  if (w1 > w2 && last == 1) return w1;
  if (w1 < w2 && last == 2) return w2;
  return -1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (x == 1)
      a1[i]++;
    else
      a2[i]++;
    a1[i] += a1[i - 1];
    a2[i] += a2[i - 1];
  }
  for (int t = 1; t <= n; t++) {
    int s = check(t);
    if (s != -1) ans.push_back(make_pair(s, t));
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", (int)ans.size());
  for (int i = 0; i < (int)ans.size(); i++) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
