#include <bits/stdc++.h>
std::mt19937 rnd(1337);
void ios() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
}
void solve() {
  int32_t n;
  std::cin >> n;
  std::vector<int32_t> a(n);
  std::vector<std::pair<int32_t, int32_t>> res;
  for (int32_t i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  if (a[n - 1] == 2) {
    for (auto &elem : a) elem = 3 - elem;
  }
  std::vector<int32_t> pref(n + 1, 0);
  for (int32_t i = 0; i < n; ++i) {
    pref[i + 1] = pref[i] + (a[i] == 1);
  }
  for (int32_t t = 1; t <= n; ++t) {
    int32_t l = 0;
    bool can = true;
    int32_t first = 0, second = 0;
    bool last;
    while (l < n) {
      int32_t left = -1, right = n - l;
      while (right - left > 1) {
        int32_t mid = (left + right) / 2;
        int32_t cntOne = pref[l + mid] - pref[l];
        if (std::max(cntOne, mid - cntOne) >= t) {
          right = mid;
        } else {
          left = mid;
        }
      }
      int32_t cntOne = pref[l + right] - pref[l];
      if (std::max(cntOne, right - cntOne) != t) {
        can = false;
        break;
      } else {
        l += right;
        if (a[l - 1] == 1) {
          ++first;
          last = true;
        } else {
          ++second;
          last = false;
        }
      }
    }
    if (can && first != second && (first > second == last)) {
      res.emplace_back(std::max(first, second), t);
    }
  }
  std::sort(res.begin(), res.end());
  std::cout << res.size() << '\n';
  for (auto &elem : res) std::cout << elem.first << ' ' << elem.second << '\n';
}
int32_t main() {
  ios();
  solve();
  return 0;
}
