#include <bits/stdc++.h>   using namespace std;   int a[212345], s1[212345], s2[212345], pos1[212345], pos2[212345], n;   vector<pair<int, int> > res;   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) {       s1[i] = s1[i - 1] + (a[i] == 1);       s2[i] = s2[i - 1] + (a[i] == 2);     }     for (int i = n; i >= 1; i--) {       pos1[s1[i]] = i;       pos2[s2[i]] = i;     }     for (int i = 1; i <= n; i++) pos1[s1[n] + i] = pos2[s2[n] + i] = n + 1;     for (int t = 1; t <= n; t++) {       int curPos = 0;       int win1 = 0;       int win2 = 0;       while (curPos < n) {         curPos = min(pos1[s1[curPos] + t], pos2[s2[curPos] + t]);         if (curPos <= n) {           if (a[curPos] == 1)             win1++;           else             win2++;         }       }       if (curPos == n && win1 != win2 && ((win1 > win2) == (a[curPos] == 1)))         res.push_back(make_pair(max(win1, win2), t));     }     sort(res.begin(), res.end());     cout << (int)res.size() << endl;     for (int i = 0; i < (int)res.size(); i++)       cout << res[i].first <<     << res[i].second << endl;     return 0;   }   