#include<bits/stdc++.h>
using namespace std;
int main(){
    int i,j,n,m,a[100][100]={0},h=0,l=0;
    cin>>n>>m;
    for(i=0;i<n;i++){
    	for(j=0;j<m;j++){
    		cin>>a[i][j];
    		if(a[i][j]%2==0){
			    h++;
				 
    		}else{
    			l++;
    		}
    	}
    }
    cout<<l<<" "<<h;
	
}

/**************************************************************
	Problem: 1398
	User: chenyaohuo
	Language: C++
	Result: Accepted
	Time:20 ms
	Memory:2072 kb
****************************************************************/