#include <bits/stdc++.h>

int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> cnt(n);
  for (int i = 0; i < n; ++i) {
    std::string s;
    std::cin >> s;
    for (int j = 0; j < m; ++j) if (s[j] - '0' == 1) ++cnt[i];
  }

  long long odd = 0, even = 0;
  for (int i = 0; i < n; ++i) {
    if (cnt[i] & 1) ++odd;
    else ++even;
  }

  std::cout << odd * even << std::endl;
  return 0;
}

#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
#include <unordered_map>
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for(ll i = (a-1); i >= (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define spre cout<<fixed<<setprecision(1);
typedef long long int ll;
using namespace std;
// ll mod=67280421310721;
// ll mod=8589934592;
const ll mod=985661441;
ll INF=1e18;
ll po(ll a,ll b){
	ll re=1;  
	while(b)
	{
		if(b%2==1)
		{
			re=(re*a);
			re%=mod;
		}
		a=(a*a);
		a%=mod;
		b>>=1;
	}
	return re;
}
ll e=5000000;
int main()
{
	
	ll test=1;
	// cin>>test;
	// spre
	while(test--)
	{
		
		ll n,m;
		cin>>n>>m;
		string s;
		ll a[2]={0},l=0;
		FOR(i,0,n)

		{
			cin>>s;
			l=0;
			
			FOR(j,0,m)
			{
				l^=(s[j]-'0');
			}
			// cout<<l<<' ';
			a[l]++;
		}
		cout<<a[0]*a[1];
	}
	return 0;
}
