#include<bits/stdc++.h>
using namespace std;
int main(){
	int a[100][100]={0},j=0,o=0,i,m,n,p;
	cin>>i>>m;
	for(n=0;n<i;n++){
		for(p=0;p<m;p++){
			cin>>a[n][p];
			if(a[n][p]%2!=0){
				j=j+1;
			}else{
				o=o+1;
			}
			
		}
	}
	cout<<j<<" "<<o;
}
/**************************************************************
	Problem: 1398
	User: huxuanchen
	Language: C++
	Result: Accepted
	Time:19 ms
	Memory:2072 kb
****************************************************************/