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