#include<iostream>
using namespace std;
int main(){
long long n,nzdn[n],ngnn,ngnch,brnn,brnch,buff,brn,brch,broqch;
cin >> n;
buff=n;
broqch=0;
while(broqch!=n){
    cin >> nzdn[n];
    broqch++;
}
while (n>=0){
    if(nzdn[n]%2!=0){
        if(nzdn[n]>ngnn){
            ngnn=nzdn[n];
        }
    }
    else if(nzdn[n]>ngnch){
        ngnch=nzdn[n];
    }
    n=n-1;
}

n=buff;
broqch=0;
while (n>=0){
    if(nzdn[n]%2==0){
        brnch++;
    }
    else{
        brnn++;
    }
    n=n-1;
}
while(broqch<ngnch){
    brch++;
    broqch++;
    broqch++;
}
broqch=0;
while(broqch<ngnn){
    brn++;
    broqch++;
    broqch++;
}
cout<<0<<" "<<0;






return 0;}