// Problem: C. The Sports Festival
// Contest: Codeforces - Codeforces Round #715 (Div. 2)
// URL: https://codeforces.com/contest/1509/problem/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)


/*
    authored by
    aden_frost
    on 07-03-2021
    Go Corona Corona Go!!
    hurray! mission - 1 - completed;
    mission - 2
    ____________

    40 more to go
*/
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
#define lli long long int
#define MOD1 998244353
#define MOD 1000000007
using namespace std;
using namespace std::chrono;
void fastaf(void)
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

void solve(void)
{
	lli N,M;
	map<lli,lli>mp;
	cin>>N>>M;
	for(int i=0;i<N;i++)
	{
		string S;
		cin>>S;
		lli sum=0;
		for(int j=0;j<M;j++)
			sum+=(S[j]-'0');
		mp[sum]++;
	}
	lli ans=0;
	for(auto x: mp)
	{
		lli sum=0;
		for(auto y: mp)
		{
			if((x.first!=y.first)&&(abs(x.first-y.first)%2!=0))
			{
				sum+=y.second;
			}
		}
		sum*=x.second;
		ans+=sum;
	}
	ans/=2;
	cout<<ans;
}
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
int main()
{
    fastaf(); 
    int Testcases=1;
    //cin>>Testcases;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    while(Testcases--)
    {
        solve();
        cout<<"\n";
    }
    return 0;
}
#include<stdio.h>
#define reg register
#define ri reg int
#define rep(i, x, y) for(ri i = x; i <= y; ++i)
#define nrep(i, x, y) for(ri i = x; i >= y; --i)
#define DEBUG 1
#define ll long long
#define il inline
#define swap(a, b) ((a) ^= (b) ^= (a) ^= (b))
#define max(i, j) (i) > (j) ? (i) : (j)
#define min(i, j) (i) < (j) ? (i) : (j)
#define read(i) io.READ(i)
#define print(i) io.WRITE(i)
#define push(i) io.PUSH(i)
struct IO {
#define MAXSIZE (1 << 20)
#define isdigit(x) (x >= '0' && x <= '9')
  char buf[MAXSIZE], *p1, *p2;
  char pbuf[MAXSIZE], *pp;
#if DEBUG
#else
  IO() : p1(buf), p2(buf), pp(pbuf) {}
  ~IO() {
    fwrite(pbuf, 1, pp - pbuf, stdout);
  }
#endif
  inline char gc() {
#if DEBUG
    return getchar();
#endif
    if(p1 == p2)
      p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin);
    return p1 == p2 ? ' ' : *p1++;
  }
  inline bool blank(char ch) {
    return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
  }
  template <class T>
  inline void READ(T &x) {
    register double tmp = 1;
    register bool sign = 0;
    x = 0;
    register char ch = gc();
    for(; !isdigit(ch); ch = gc())
      if(ch == '-') sign = 1;
    for(; isdigit(ch); ch = gc())
      x = x * 10 + (ch - '0');
    if(ch == '.')
      for(ch = gc(); isdigit(ch); ch = gc())
        tmp /= 10.0, x += tmp * (ch - '0');
    if(sign) x = -x;
  }
  inline void READ(char *s) {
    register char ch = gc();
    for(; blank(ch); ch = gc());
    for(; !blank(ch); ch = gc())
      *s++ = ch;
    *s = 0;
  }
  inline void READ(char &c) {
    for(c = gc(); blank(c); c = gc());
  }
  inline void PUSH(const char &c) {
#if DEBUG
    putchar(c);
#else
    if(pp - pbuf == MAXSIZE) {
      fwrite(pbuf, 1, MAXSIZE, stdout);
      pp = pbuf;
    }
    *pp++ = c;
#endif
  }
  template <class T>
  inline void WRITE(T x) {
    if(x < 0) {
      x = -x;
      PUSH('-');
    }
    static T sta[35];
    T top = 0;
    do {
      sta[top++] = x % 10;
      x /= 10;
    } while(x);
    while(top)
      PUSH(sta[--top] + '0');
  }
  template <class T>
  inline void WRITE(T x, char lastChar) {
    WRITE(x);
    PUSH(lastChar);
  }
} io;
ll n, m, odd, even, num, a;
int main() {
	read(n), read(m);
	rep(i, 1, n) {
		num = 0;
		rep(j, 1, m) {
			scanf("%1lld", &a);
			num += a;
		}
		if(num % 2) ++odd;
		else ++even;
	}
	print(odd * even);
}