/*...................................................................*
 *............___..................___.....____...______......___....*
 *.../|....../...\........./|...../...\...|.............|..../...\...*
 *../.|...../.....\......./.|....|.....|..|.............|.../........*
 *....|....|.......|...../..|....|.....|..|............/...|.........*
 *....|....|.......|..../...|.....\___/...|___......../....|..___....*
 *....|....|.......|.../....|...../...\.......\....../.....|./...\...*
 *....|....|.......|../_____|__..|.....|.......|..../......|/.....\..*
 *....|.....\...../.........|....|.....|.......|.../........\...../..*
 *..__|__....\___/..........|.....\___/...\___/.../..........\___/...*
 *...................................................................*
 */
 
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1000000000000000000

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int tt=1;
	//cin >> tt;
	while(tt--)
	{
		int n,m;
		cin >> n >> m;
		string s[n];
		for(int i=0;i<n;i++)
		{
			cin >> s[i];
		}
		int o=0,e=0;
		for(int i=0;i<n;i++)
		{
			int c=0;
			for(int j=0;j<m;j++)
			{
				if(s[i][j]=='1')
					c++;
			}
			if(c%2==0)
				e++;
			else
				o++;
		}
		cout << o*e << '\n';
	}
	return 0;
}
#include<iostream>
#include<cstdio>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;++i)
#define fod(i,a,b) for(int i=a;i>=b;--i)
#define LL long long
int n,m;
LL ans=0;
int main(){
	scanf("%d%d",&n,&m);
	char s[30];
	int sum=0;
	fo(i,1,n){
		scanf("%s",s);
		int u=0;
		fo(j,1,m){
			if(s[j-1]=='1')++u;
		}
		if(u&1){
			ans+=i-sum-1;
			++sum;
		}
		else ans+=sum;
	}
	printf("%lld",ans);
	return 0;
} 