#include <bits/stdc++.h>
using namespace std;
int n;
int s1[111111];
int s2[111111];
int sum1(int s, int f) {
  if (s > f) return 0;
  return s1[f] - s1[s - 1];
}
int sum2(int s, int f) {
  if (s > f) return 0;
  return s2[f] - s2[s - 1];
}
bool norm(int t, int& s) {
  int p = 1;
  int a1 = 0;
  int a2 = 0;
  int l;
  while (p <= n) {
    int pp = p;
    p--;
    for (int i = 20; i >= 0; --i) {
      if (p + (1 << i) > n) continue;
      if (sum1(pp, p + (1 << i)) >= t || sum2(pp, p + (1 << i)) >= t) continue;
      p += (1 << i);
    }
    p++;
    if (sum1(pp, p) != t && sum2(pp, p) != t) return false;
    if (sum1(pp, p) == t)
      a1++, l = 1;
    else
      a2++, l = 2;
    p++;
  }
  if (a1 > a2 && l == 2) return false;
  if (a1 < a2 && l == 1) return false;
  if (a1 == a2) return false;
  s = max(a1, a2);
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  int x;
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    if (x == 1)
      s1[i] = 1;
    else
      s2[i] = 1;
  }
  for (int i = 1; i <= n; ++i) {
    s1[i] += s1[i - 1];
    s2[i] += s2[i - 1];
  }
  vector<pair<int, int> > ans;
  for (int t = 1; t <= n; ++t) {
    int s;
    if (norm(t, s)) ans.push_back(make_pair(s, t));
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << "\n";
  for (int i = 0; i < ans.size(); ++i)
    cout << ans[i].first << " " << ans[i].second << "\n";
  return 0;
}
