#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(ll i=ll(m); i<ll(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<ll,ll>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }

const int  INF = (1 << 30) - 1;
const ll INFL = 1LL << 61;
const ll mod =998244353;





int main() {
	int n, m;
	cin >> n >> m;
	VLL a(2);
	REP(i, n) {
		string s;
		cin >> s;
		int cnt = 0;
		REP(j, m) {
			if (s[j] == '1')cnt++;
		}
		a[cnt % 2]++;
	}
	cout << a[0] * a[1] << endl;

}
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+2;
int n,m,cn[2];
long long ans;
int main()
{
	scanf("%d%d",&n,&m);
	for(int x;n;--n)
	{
		int val=0;
		for(int j=m-1;~j;--j)
		{
			scanf("%1d",&x);
			val^=x;
		}
		ans+=cn[!val];
		++cn[val];
	}
	printf("%lld",ans);
}
