#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, cnt1, cnt2, m;
	cin >> n >> m;
	cnt1 = cnt2 = 0;
	for (int i = 1; i <= n; i++) {
		string s;
		cin >> s;
		int cnt = 0;
		for (auto p : s) p == '1' ? cnt++ : 0;
		cnt & 1 ? cnt1++ : cnt2++;
	}
	cout << 1ll * cnt1 * cnt2 << endl;
}
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vv = vector<vi>;
const ll INF = 1001001001001001001;

int main(){
    int n, m;
    cin >> n >> m;
    vi a(2, 0);
    rep(i,n){
        string s;
        cin >> s;
        int num = 0;
        rep(j,m)num += s[j]-'0';
        a[num%2]++;
    }
    
    cout << a[0]*a[1] << endl;
    
    return 0;
}