#include <bits/stdc++.h>
using namespace std;
int ta[100005], tb[100005];
vector<pair<int, int> > arr;
int main() {
  int n, i, j, x, y, z;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &x);
    ta[i] = ta[i - 1];
    tb[i] = tb[i - 1];
    if (x == 1)
      ta[i]++;
    else
      tb[i]++;
  }
  for (i = 1; i <= n; i++) {
    int tmp = 1, flag = 1, lt;
    x = y = 0;
    while (tmp <= n && flag) {
      int l = tmp - 1, r = n, m;
      while (l + 1 < r) {
        m = (l + r) / 2;
        if (ta[m] - ta[tmp - 1] >= i || tb[m] - tb[tmp - 1] >= i)
          r = m;
        else
          l = m;
      }
      if (ta[r] - ta[tmp - 1] == i)
        x++, lt = 1;
      else if (tb[r] - tb[tmp - 1] == i)
        y++, lt = 2;
      else
        flag = 0;
      tmp = r + 1;
    }
    if (flag && (lt == 1 && x > y || lt == 2 && y > x)) {
      arr.push_back(make_pair(max(x, y), i));
    }
  }
  sort(arr.begin(), arr.end());
  printf("%d\n", arr.size());
  for (i = 0; i < arr.size(); i++)
    printf("%d %d\n", arr[i].first, arr[i].second);
}
