#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char s[30];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int cnt0=0,cnt1=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s+1);
		int cnt=0;
		for(int j=1;j<=m;j++)cnt+=(s[j]==49);
		if(cnt&1) cnt1++;
		else cnt0++;
	}
	printf("%lld",(long long)cnt0*cnt1);
	return 0;
}
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 1e9;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep2(i, x, n) for(int i = x; i < (n); i++)
#define all(n) begin(n), end(n)

void Main() {
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    vector<int> cnt(n);
    rep(i, n) rep(j, m) if(s[i][j] == '1')++ cnt[i];
    ll sum = 0;
    vector<int> r(n);
    ll sum2 = 0;
    vector<int> r2(n);
    rep(i, n) {
        if(cnt[i] % 2 == 1) {
            ++sum;
        } else {
            ++sum2;
        }
        r[i] = sum;
        r2[i] = sum2;
        // cout << sum << endl;
        // cout << sum2 << endl;
    }
    ll ans = 0;
    rep(i, n) {
        if(cnt[i] % 2 == 1) {
            // cout << sum2 << " " << r2[i] << endl;
            ans += sum2 - r2[i];
        } else {
            // cout << sum << " " << r[i] << endl;
            ans += sum - r[i];
        }
    }
    cout << ans << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}