#include <bits/stdc++.h>
using namespace std;
int p1[100005], p2[100005], n, isProcessed[100005];
vector<pair<int, int> > ans;
void process(int t) {
  int pos1 = 0, pos2 = 0, val1 = 0, val2 = 0, win1 = 0, win2 = 0;
  while (1) {
    pos1 = lower_bound(p1 + 1, p1 + n + 1, p1[pos1] + t) - (p1);
    pos2 = lower_bound(p2 + 1, p2 + n + 1, p2[pos2] + t) - (p2);
    if (pos1 < pos2) {
      win1++;
      if (pos1 == n) {
        if (win1 > win2) ans.push_back(make_pair(win1, t));
        break;
      }
      pos2 = pos1;
    } else if (pos2 < pos1) {
      win2++;
      if (pos2 == n) {
        if (win2 > win1) ans.push_back(make_pair(win2, t));
        break;
      }
      pos1 = pos2;
    } else {
      break;
    }
  }
}
int main() {
  int i, j, m, temp;
  cin >> n;
  memset(p1, 0, sizeof(p1));
  memset(p2, 0, sizeof(p2));
  for (i = 1; i <= n; i++) {
    cin >> temp;
    isProcessed[i] = false;
    (temp == 1) ? (p1[i] = p1[i - 1] + 1, p2[i] = p2[i - 1])
                : (p1[i] = p1[i - 1], p2[i] = p2[i - 1] + 1);
  }
  for (i = 1; i <= n; i++) {
    if (p1[i] > p2[i] && !isProcessed[p1[i]]) {
      process(p1[i]);
      isProcessed[p1[i]] = true;
    } else if (p2[i] > p1[i] && !isProcessed[p2[i]]) {
      process(p2[i]);
      isProcessed[p2[i]] = true;
    }
  }
  cout << ans.size() << "\n";
  sort(ans.begin(), ans.end());
  for (i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
  return 0;
}
