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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n, m;
	cin >> n >> m;

	array<int, 2> c = {0};
	long long ans = 0;

	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		int now = count(s.begin(), s.end(), '1') % 2;
		c[now] += 1;
		ans += c[1 - now];
	}
	cout << ans << '\n';
	return 0;
}
#include <bits/stdc++.h>
using namespace std; 

int main(){
	int n,m;
	cin>>n>>m;
	long long odd=0,even=0;
	while(n--){
		string s;
		cin>>s;
		int ones=0;
		for(char c:s){
			if(c=='1') ones++; 
		}
		if(ones%2) odd++;
		else even++;			
	}
	cout<<(long long)odd*even<<endl;
	return 0;
}

