#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,a[1000][1000],g,s,b,q,c=0;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j];
        }
    }
 
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            g=a[i][j]%10;
            s=a[i][j]/10%10;
            b=a[i][j]/100%10;
            q=a[i][j]/1000%10;
            if((g+s+b+q)%2!=0) c++;
        }
    }
    cout<<c;
    return 0;
}
/**************************************************************
	Problem: 1496
	User: panjinyan
	Language: C++
	Result: Accepted
	Time:10 ms
	Memory:5852 kb
****************************************************************/