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