#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define mod 998244353
#define MOD 1000000007
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
// aのn乗を求める(modp)
int modPow(ll a, ll n, ll p) {
  if (n == 0) return 1; // 0乗にも対応する場合
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  ll t = modPow(a, n / 2, p);
  return (t * t) % p;
}

int main(){
  ll n, m;
  cin >> n >> m;
  string s;
  ll odd = 0, even = 0;
  rep(i, n){
    cin >> s;
    ll count = 0, len = s.size();
    rep(i, len){
      if(s[i] == '1') count++;
    }
    if(count%2 == 0) even++;
    else odd++;
  }
  cout << odd*even << endl;
}
#include <bits/stdc++.h>
using namespace std;
#define deb(k) cerr << #k << ": " << k << "\n";
#define size(a) (int)a.size()
#define fastcin cin.tie(0)->sync_with_stdio(0);
#define st first
#define nd second
#define pb push_back
#define mk make_pair
#define int long long
typedef long double ldbl;
typedef double dbl;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef vector<int> vint;
#define MAXN 300100
#define MAXLG 20
const int inf = 0x3f3f3f3f;
const ll mod = 1000000007;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int N = 300100;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve(){
	int n, m;
	cin>>n>>m;
	string s[n];
	map<int, int>f;
	vint a(n);
	for(int i=0;i<n;i++){
		cin>>s[i];
		for(int j=0;j<m;j++){
			a[i] *= 2;
			a[i] += (s[i][j] - '0');
		}
		f[a[i]]++;
	}
	queue<pii>q;
	q.push({0, 0});
	int x = 0, y = 0;
	bitset<(1<<20)> vis;
	vis[0] = 1;
	while(!q.empty()){
		pii a = q.front();
		q.pop();
		if(a.nd == 0) x += f[a.st];
		else y += f[a.st];
		for(int i=0;i<m;i++){
			int aux = a.st ^ (1<<i);
			if(vis[aux]) continue;
			vis[aux] = 1;
			q.push({aux, a.nd^1});
		}
	}
	cout<<x*y<<"\n";





	// Have you read the problem again?
	// Maybe you understood the wrong problem
}

int32_t main(){
	fastcin;
	int t_ = 1;
	//cin>>t_;
	while(t_--)
		solve();
	return 0;
}
