#include <iostream>
#include <string>

int main() {
  int N, M;
  long long odd = 0, even = 0;
  std::cin >> N >> M;
  for (int i = 0; i < N; i++) {
    std::string S;
    std::cin >> S;
    bool f = false;
    for (char c : S)
      f ^= (c == '1');
    (f ? odd : even)++;
  }
  
  std::cout << 1LL * odd * even << "\n";
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int MOD = 1000000007;

signed main() {
    int n, m;
    cin >> n >> m;
    string s[n];
    rep(i, n) {
        cin >> s[i];
    }
    ll ans = 0;
    int even = 0, odd = 0;
    rep(i, n) {
        int cnt = 0;
        rep(j, m) {
            if (s[i][j] == '1') cnt++;
        }
        if (cnt % 2 == 0) {
            ans += odd;
            even++;
        } else {
            ans += even;
            odd++;
        }
    }
    cout << ans << endl;
    return 0;
}