#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define endl '\n'

string s[100005];

int dist(string& a, string& b) {
	int ret = 0;
	for (size_t i = 0; i < a.length(); i++) {
		if (a[i] != b[i]) ret++;
	}
	return ret;
}
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	long long first = 0;
	long long ans = 0;
	for (int i = 1; i < n; i++) {
		if (dist(s[0], s[i]) & 1) first++;
	}
	ans = first;
	for (int i = 1; i < n; i++) {
		if (dist(s[0], s[i]) & 1) {
			ans += n - first;
		}
		else {
			ans += first;
		}
	}
	cout << ans / 2 << endl;
	return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, m; cin >> n >> m;
  long long odd = 0, even = 0;
  for(int i = 0; i < n; ++i){
    int count = 0;
    string s; cin >> s;
    for(int j = 0; j < m; ++j){
      if(s[j] == '1'){count += 1;}
    }
    if(count%2 == 1){odd += 1;}
    else{even += 1;}
  }
  cout << odd*even << endl;
}