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

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define MAX(v) (*max_element((v).begin(), (v).end()))
#define MIN(v) (*min_element((v).begin(), (v).end()))
#define pb push_back
#define FOR(i, n) for(int i = 0; i < (n); i++)
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int mod = 1e9 + 7;
const int mod2 = 998244353;

ll exp(ll base, ll e, ll md) {
    ll mul = base % md;
    ll res = 1;
    while(e){
        if(e & 1) res = (res*mul) % md;
        e >>= 1;
        mul = mul*mul % md;
    }
    return res;
}

const int N = 2e5 + 5;

int main(){
    ios::sync_with_stdio(false); cin.tie(NULL);
    int n, m; cin>>n>>m;
	int cnt[2] = {};
	ll ans = 0;
	FOR(i, n){
		bool par = 0;
		FOR(i, m){
			char c; cin>>c;
			par ^= c == '1';
		}
		ans += cnt[!par];
		cnt[par]++;
	}
	cout<<ans<<"\n";
}
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,m;
string str[MAXN];
int main()
{
    scanf("%d%d",&n,&m);
    int cnt=0;
    for(int i=0;i<n;i++) 
    {
        cin>>str[i];
        int s=0;
        for(int j=0;j<m;j++) if(str[i][j]=='1') s++;
        if(s&1) cnt++;
    } 
    printf("%lld\n",1LL*cnt*(n-cnt));
    return 0;
}