#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, x;
  vector<int> p1(200050, 1e9), p2(200050, 1e9);
  int p = 1, q = 1;
  p1[0] = 0, p2[0] = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (x == 1)
      p1[p] = i, p++;
    else
      p2[q] = i, q++;
  }
  int winner = p1[p - 1] > p2[q - 1] ? 1 : 2;
  vector<pair<int, int>> res;
  int ls = max(p1[p - 1], p2[q - 1]);
  for (int t = 1; t <= n; t++) {
    int s1 = 0, s2 = 0;
    int k = 0, k1 = 0, k2 = 0;
    for (; k < n;) {
      if (p1[k1 + t] > p2[k2 + t]) {
        k = p2[k2 + t], s2++;
        k1 = upper_bound(p1.begin(), p1.end(), k) - p1.begin() - 1;
        k2 += t;
      } else {
        k = p1[k1 + t], s1++;
        k2 = upper_bound(p2.begin(), p2.end(), k) - p2.begin() - 1;
        k1 += t;
      }
    }
    if (s1 > s2 && winner == 1 && k == n)
      res.push_back({s1, t});
    else if (s2 > s1 && winner == 2 && k == n)
      res.push_back({s2, t});
  }
  sort(res.begin(), res.end());
  cout << res.size() << "\n";
  for (int i = 0; i < res.size(); i++)
    cout << res[i].first << " " << res[i].second << "\n";
}
