#include <bits/stdc++.h>
using namespace std;
void reverse(string &s, int begin, int end) {
  end--;
  if (end <= begin) return;
  for (int i = begin; i <= (end + begin) / 2; ++i) {
    swap(s[i], s[end + begin - i]);
  }
}
string shift(string &s, int k) {
  string ans = s;
  reverse(ans, 0, ans.size());
  reverse(ans, 0, k);
  reverse(ans, k, ans.size());
  return ans;
}
void normalize(string &s) {
  int shift = s[0] - '0';
  for (int i = 0; i < s.size(); ++i) {
    s[i] = s[i] - shift;
    if (s[i] < '0') s[i] += 10;
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> pointsAt[2];
  pointsAt[0].push_back(-1);
  pointsAt[1].push_back(-1);
  for (int i = 1; i <= n; ++i) {
    int s;
    cin >> s;
    pointsAt[s - 1].push_back(i);
  }
  vector<pair<int, int>> answers;
  for (int i = 1; i <= n; ++i) {
    int sets = 0;
    int setAdv = 0;
    int maxAdv = 0;
    int servesParsed = 0;
    bool isOk = true;
    while (servesParsed < n) {
      auto first =
          lower_bound(pointsAt[0].begin(), pointsAt[0].end(), servesParsed + 1);
      auto second =
          lower_bound(pointsAt[1].begin(), pointsAt[1].end(), servesParsed + 1);
      if ((distance(first, pointsAt[0].end()) <= i - 1) &&
          (distance(second, pointsAt[1].end()) <= i - 1)) {
        isOk = false;
        break;
      } else {
        maxAdv = 0;
        if (distance(first, pointsAt[0].end()) <= i - 1) {
          servesParsed = *(second + i - 1);
        } else if (distance(second, pointsAt[1].end()) <= i - 1) {
          setAdv++;
          maxAdv = 1;
          servesParsed = *(first + i - 1);
        } else {
          if (*(first + i - 1) > *(second + i - 1)) {
            servesParsed = *(second + i - 1);
          } else {
            setAdv++;
            maxAdv = 1;
            servesParsed = *(first + i - 1);
          }
        }
      }
      sets++;
    }
    if (isOk) {
      if (((maxAdv) && (setAdv * 2 > sets)) ||
          ((maxAdv == 0) && (setAdv * 2 < sets))) {
        answers.push_back(make_pair((maxAdv) ? setAdv : sets - setAdv, i));
      }
    }
  }
  cout << answers.size() << endl;
  sort(answers.begin(), answers.end());
  for (int i = 0; i < answers.size(); ++i) {
    cout << answers[i].first << " " << answers[i].second << endl;
  }
  return 0;
}
