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

typedef long long ll;
typedef unsigned long long ull;

#define mp make_pair
#define fr first
#define sc second
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	ll cnt[2]={};
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		int t=0;
		for(char c: s)t+=c-'0';
		cnt[t&1]++;
	}
	cout<<cnt[0]*cnt[1]<<endl;
}
#include <bits/stdc++.h>

using namespace std;

#define int long long

const int N = 1e5 + 50;
string s[N];

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

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

    for (int i = 0; i < n; i++)
        cin >> s[i];

    set<int> zeroes, ones;
    set<int> nzeroes, nones;

    for (int i = 0; i < n; i++) {
        if (s[i][0] == '1')
            ones.insert(i);
        else
            zeroes.insert(i);
    }

    for (int j = 1; j < m; j++) {
        for (auto x: zeroes) {
            if (s[x][j] == '0')
                nzeroes.insert(x);
            else
                nones.insert(x);
        }
        for (auto x: ones) {
            if (s[x][j] == '1')
                nzeroes.insert(x);
            else
                nones.insert(x);
        }
        zeroes = nzeroes;
        ones = nones;
        nzeroes.clear();
        nones.clear();
    }

    cout << (int) ones.size() * (int) zeroes.size();

}


