#include <iostream>
using namespace std;
int main(){
int n,m[n],brc=0,brnc=0,segchis=m[n-1],ngc,br;
cin >> n >> m[n];
while ((segchis!=m[n-1])&&(m[n-1]%2==1)){
brnc=brnc+1;
n=n-1;
segchis=segchis+2;
}
segchis=2;
while ((n>0)&&(segchis!=m[n-1])&&(m[n-1]%2==0)){
    brc=brc+1;
    n=n-1;
    segchis=segchis+2;
}
cout << brnc << " " << brc;
return 0;
}