#include <bits/stdc++.h>

#define ll long long

using namespace std;

const int N = (int)1e5 + 7;

int n, m;
int x[N];
int ss[N];

int main() {
	scanf("%d %d", &n, &m);
	string s;
	for (int i = 0; i < n; i++) {
		cin >> s;
		for (int j = 0; j < m; j++) {
			x[i] += (s[j] - '0');
		}
		ss[x[i]]++;
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= 20; j++) {
			if (abs(j - x[i]) % 2 == 1) {
				ans += ss[j];
			}
		}
	}
	printf("%lld\n", ans / 2);
}
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<map>
#include<string>
#include<bitset>

using namespace std;

#define rep(i,N) for(ll i=0;i<N;i++) //0から


typedef long long ll;




ll binary_search(vector<ll> a, ll n, ll key){
    ll right = n, left = -1;
    ll md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}

vector<ll> prime;
void Prime(ll n){ //線形篩,素数列挙
    vector<ll> p(n,0);
    p[0]=1;
    p[1]=1;
    for(ll i=2;i<n;i++){
        if(p[i]==0){
            prime.push_back(i);
            p[i]=i;
        }
        ll k=prime.size();
        for(ll j=0;j<k && i*prime[j]<n && prime[j]<=p[i];j++){
            p[i*prime[j]]=prime[j];
        }
    }
}

ll gcd(ll a,ll b){
    if(a<b){
        swap(a,b);
    }
    //a>=b
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

ll modexp(ll x, ll a, ll m){ //x^a mod m
    ll ret = 1;
    while (a > 0) {
        if (a & 1) ret = ret * x % m;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % m;
        a >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

ll modinv(ll a, ll m){ //a^{-1} mod m
    ll b=m,u=1,v=0;
    while(b){
        ll t=a/b;
        a-=t*b; swap(a,b);
        u-=t*v; swap(u,v);
    }
    u=(u+m)%m;
    return u;
}


ll nCr(ll n, ll r) {
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

double pi=3.14159265358979323846;


//next_purmitation!!!!!!!!!!!!!
//https://atcoder.jp/contests/abc198/tasks/abc198_d
//cout<<fixed<<setprecision(18);
int main(){
    ll n,m;
    cin>>n>>m;
    vector<string> s(n);
    ll odd=0,even=0;
    rep(i,n){
        cin>>s[i];
        ll cnt=0;
        rep(j,m){
            if(s[i][j]=='1'){
                cnt++;
            }
        }
        if(cnt%2==0){
            even++;
        }
        else{
            odd++;
        }
    }

    cout<<odd*even<<endl;

    return 0;
}