#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int A[MAXN];
int p1[MAXN], p2[MAXN];
int find1(int x, int n) {
  int i = 1, j = n;
  while (i < j) {
    int middle = (i + j) / 2;
    if (p1[middle] < x)
      i = middle + 1;
    else
      j = middle;
  }
  if (p1[i] == x)
    return i;
  else
    return -1;
}
int find2(int x, int n) {
  int i = 1, j = n;
  while (i < j) {
    int middle = (i + j) / 2;
    if (p2[middle] < x)
      i = middle + 1;
    else
      j = middle;
  }
  if (p2[i] == x)
    return i;
  else
    return -1;
}
bool compare(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first < b.first;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    A[i]--;
  }
  memset(p1, 0, sizeof p1);
  memset(p2, 0, sizeof p2);
  for (int i = 1; i <= n; i++) {
    p1[i] = p1[i - 1] + 1 - A[i];
    p2[i] = p2[i - 1] + A[i];
  }
  vector<pair<int, int> > ans;
  for (int t = 1; t <= n; t++) {
    int s1 = 0, s2 = 0;
    int tf1 = 0, tf2 = 0;
    while ((s1 + s2) * t <= n) {
      int g1 = find1(tf1 + t, n);
      int g2 = find2(tf2 + t, n);
      if (g1 == g2) break;
      if (g1 == -1 || (g2 != -1 && g2 == min(g2, g1))) {
        s2++;
        tf1 = p1[g2];
        tf2 = p2[g2];
      } else if (g2 == -1 || g1 == min(g2, g1)) {
        s1++;
        tf1 = p1[g1];
        tf2 = p2[g1];
      }
    }
    if (tf1 == p1[n] && tf2 == p2[n] && s1 != s2 &&
        ((s1 > s2 && A[n] == 0) || (s2 > s1 && A[n] == 1)))
      ans.push_back({max(s1, s2), t});
  }
  sort(ans.begin(), ans.end(), compare);
  cout << ans.size() << endl;
  for (auto x : ans) {
    cout << x.first << " " << x.second << endl;
  }
  return 0;
}
