#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <cassert>
using namespace std;

#define sz(a) int((a).size())
#define rep(i, s, n)  for(int i = s; i <= (n); ++i)
#define rev(i, n, s)  for(int i = (n); i >= s; --i)
#define fore(x, a) for(auto &&x : a)
typedef long long ll;
const int mod = 1000000007;
const int N = 1000005;

int a[N];
int b[N];
int n;

int go() {
  int ans = -1;
  rep(step, 0, 3) {
    rep(i, 1, n) {
      b[i] = a[i];
    }
    int cur = 0;
    if(step & 1) {
      cur++;
      b[1] ^= 1;
      b[2] ^= 1;
    }
    if((step / 2) & 1) {
      cur++;
      b[n] ^= 1;
      b[n - 1] ^= 1;
    }
    rep(i, 1, n - 2) {
      if(b[i]) {
        b[i] ^= 1;
        b[i + 1] ^= 1;
        b[i + 2] ^= 1;
        cur++;
      }
    }
    if(b[n] == 0 && (n == 1 || b[n - 1] == 0)) {
      if(ans == -1) {
        ans = cur;
      } else {
        ans = min(ans, cur);
      }
    }
  }
  return ans;
}

int main() {
#ifdef loc
  if(!freopen((string(FOLDER) + "inp.txt").c_str(), "r", stdin)) {
    assert(0);
  }
  freopen((string(FOLDER) + "out.txt").c_str(), "w", stdout);
#endif
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  rep(i, 1, n) {
    cin >> a[i];
    a[i] &= 1;
  }
  int ans1 = go();
  rep(i, 1, n) {
    a[i] ^= 1;
  }
  int ans2 = go();
  cout << ans2 << " " << ans1 << endl;
  return 0;
}