#include <bits/stdc++.h>

#define index(i, n) for (long long i = 0; i < n; i++)
#define index1(i, n) for (long long i = 1; i <= n; i++)
#define range(i, a, b) for (long long i = a; i < b; i++)
#define indexD(i, n) for (long long i = n - 1; i >= 0; i--)
#define index1D(i, n) for (long long i = n; i >= 1; i--)
#define rangeD(i, a, b) for (long long i = a - 1; i >= b; i--)
#define ceild(a, b) ((a) / (b) + ((a) % (b) != 0))
#define fast_io std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define print(x) cout << (x) << '\n'
#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x, y) cout << '>' << #x << ':' << x << " | " << #y << ':' << y << endl;
#define trace3(x, y, z) cout << '>' << #x << ':' << x << " | " << #y << ':' << y << " | " << #z << ':' << z << endl;
#define trace4(x, y, z, w) cout << '>' << #x << ':' << x << " | " << #y << ':' << y << " | " << #z << ':' << z << " | " << #w << ':' << w << endl;
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define First first
#define Second second
#define MOD 1000000007
#define INF (9223372034707292159ll)

typedef unsigned long long ull;
typedef long long int ll;

using namespace std;

int main()
{
        fast_io;

        ll t, n, m, k, x, y, r, ans, c;
        ull pow2[21];
        pow2[0] = 1;
        index1(i, 20) { pow2[i] = 2 * pow2[i - 1]; }
        ans = 0;
        cin >> n >> m;
        string s;
        ll even = 0, odd = 0;
        index(i, n)
        {
                cin >> s;
                x = 0;
                index(j, m) x += (s[j] == '1');
                if (x % 2)
                        odd++;
                else
                        even++;
        }
        print((odd * even));
        return 0;
}

#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
int a[2];
int main() {
	int n, m;
	string s;
	cin >> n >> m;
	for(int i = 1; i <= n; ++i) {
		cin >> s;
		int x = 0;
		for(int j = 0; j < m; ++j) {
			x ^= (s[j] - '0');
		}
		a[x]++;
	}	
	print(1ll * a[1] * a[0]);
}