#include "bits/stdc++.h"

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(X) begin(X), end(X)
#define size(X) (int)std::size(X)

using ll = long long;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

int main()
{ _
    int n, m;
    cin >> n >> m;

    constexpr int mmax = 20;

    int cnt[2]{};

    for (int i = 0; i < n; ++i)
    {
        bitset<mmax> b;
        cin >> b;
        cnt[b.count() % 2] += 1;
    }

    ll res = 1LL * cnt[0] * cnt[1];
    cout << res << endl;

    exit(0);
}

#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

#define LL long long
#define mem(s, v) memset(s, v, sizeof s)
#define FILEIN(s) freopen(s".in", "r", stdin)
#define FILEOUT(s) freopen(s".out", "w", stdout)

inline LL read(void) {
	LL x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return f * x;
}

const int maxn = 1e5 + 5;

int n, m;

int a[maxn];
long long ans;
int cnt1[maxn], cnt2[maxn];
char op[30];

int main() {
	n = read(); m = read();
	for (int i = 1; i <= n; ++ i) {
		scanf("%s", op + 1);
		int res = 0;
		for (int j = 1; j <= m; ++ j) {
			if (op[j] == '1') ++ res;
		}
		cnt1[i] = cnt1[i - 1];
		cnt2[i] = cnt2[i - 1];
		if (res & 1) ans += cnt2[i], cnt1[i]++; 
		else ans += cnt1[i], cnt2[i] ++;
	}
	printf("%lld\n", ans);
	return 0;
}
