#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <iomanip>
#include <functional>
using namespace std;
typedef long long ll;
int n,m;
string s[100010];
int k[100010];
int main(){
    cin >> n >> m;
    for(int i=0;i<n;i++)cin >> s[i];
    ll a=0,b=0;
    for(int i=0;i<n;i++){
        int cnt=0;
        for(int j=0;j<m;j++){
            if(s[i][j]!=s[0][j]){
                cnt++;
            }
        }
        if(cnt%2==0)a++;
        else b++;
    }
    cout << a*b << endl;
    return 0;
}

#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,int>
#define mp make_pair
#define pll pair<long long,long long>

using namespace std;

ll xd[2];

void solve(){
    int n,m; cin>>n>>m;
    while(n--){
        string s; cin>>s;
        int x = 0;
        for(char y : s){
            if(y == '1') x++;
        }
        xd[x % 2]++;
    }
    cout<<xd[0] * xd[1];
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    solve();
    return 0;
}
