#include<bits/stdc++.h>
using namespace std;
int n,m;
int sum[30];
char a[30];
int main()
{
	cin>>n>>m;	
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%s",a+1);
		int t=0;
		for(int j=1;j<=m;j++)
		{
			if(a[j]=='1') t++;  
		}
		if(t%2==1) ans+=sum[2],sum[1]++;
		else ans+=sum[1],sum[2]++;
	}
//	puts("");
//	for(int i=1;i<=m;i++) cout<<b[i]<<' ';
	cout<<ans<<endl;
	return 0;
} 
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define rng(v) v.begin(),v.end()
#define rngr(v) v.rbegin(),v.rend()
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using P3 = tuple<int, int, int>;
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define vs vector<string>
using vp = vector<P>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using CP = complex<double>;
double dot( const CP &z, const CP &w ){ return (z.real()*w.real() + z.imag()*w.imag()); }
double cross( const CP &z, const CP &w ){ return (z.real()*w.imag() - z.imag()*w.real()); }
int main()
{
    int n, m;
    cin >> n >> m;
    ll a = 0;
    ll b = 0;
    rep(i, n) {
        string s;
        cin >> s;
        int c = 0;
        for(auto j : s) if(j-'0' == 1) c++;   
        (c%2 == 0 ? a : b)++;     
    }
    cout << a*b << endl;
    return 0;
}
