#include <bits/stdc++.h>

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define all(s) s.begin(), s.end()

using namespace std;

int n, m, c, a[2];
long long ans;

string s;

int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> s;
        c = 0;
        for (int j = 0; j < m; j++) {
            c += (s[j] - 48);
        }
        if (c & 1)
            ans += a[0], a[1]++;
        else
            ans += a[1], a[0]++;
        
    }
    cout << ans << endl;
}

#include <iostream>
using namespace std;
int main() {
    int n, m; cin >> n >> m;
    int a[2] = {0, 0};
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        int t = 0;
        for (char c : s) if (c == '1') t ^= 1;
        a[t]++;
    }
    cout << (long long)a[0] * a[1] << endl;
}
