#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e5 + 10;
int n, a[N], p, pos, c1, c2, ps[N], ps2[N];
vector<pair<int, int>> ans;
int bin(int b, int e, int num) {
  int mid = (b + e) >> 1;
  if (b + 1 == e) {
    if (ps[b] - ps[pos] == num) return b;
    if (ps2[b] - ps2[pos] == num) return b;
    return N - 1;
  }
  int s1 = ps[mid - 1] - ps[pos], s2 = ps2[mid - 1] - ps2[pos];
  if (s1 < num && s2 < num) return bin(mid, e, num);
  return bin(b, mid, num);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    ps[i] = ps[i - 1];
    ps2[i] = ps2[i - 1];
    if (a[i] == 2)
      ps2[i]++;
    else
      ps[i]++;
  }
  for (int i = 1; i <= n; i++) {
    c1 = c2 = pos = 0;
    while (pos < n) {
      p = bin(pos + 1, n + 1, i);
      if (p == n) {
        if (ps[p] - ps[pos] == i) {
          if (c1 < c2) break;
        } else {
          if (c2 < c1) break;
        }
      }
      if (ps[p] - ps[pos] == i)
        c1++;
      else
        c2++;
      pos = p;
    }
    if (pos == n && c1 != c2) ans.push_back({max(c1, c2), i});
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << '\n';
  for (int i = 0; i < (int)ans.size(); i++)
    cout << ans[i].first << ' ' << ans[i].second << '\n';
  return 0;
}
