/**
 *  created: 21/03/2021, 13:00:59
**/

#include <bits/stdc++.h>

using namespace std;

template<bool inv, typename T>
void xor_convolution(int n, T a[]) {
    if (n == 0) {
        return;
    }
    for (int i = 0; i < n / 2; ++i) {
        T x = a[i] + a[i + n / 2], y = a[i] - a[i + n / 2];
        a[i] = x;
        a[i + n / 2] = y;
        if (inv) {
            a[i] /= 2;
            a[i + n / 2] /= 2;
        }
    }
    xor_convolution<inv>(n / 2, a);
    xor_convolution<inv>(n / 2, a + n / 2);
}

char buf[33];

string read() {
    scanf("%s", buf);
    return buf;
}

const int max_x = 1 << 20;

int n, m;
long long cnt[max_x];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++i) {
        string s = read();
        int x = 0;
        for (int j = 0; j < m; ++j) {
            x = x * 2 + s[j] - '0';
        }
        ++cnt[x];
    }
    xor_convolution<false>(1 << m, cnt);
    for (int i = 0; i < (1 << m); ++i) {
        cnt[i] *= cnt[i];
    }
    xor_convolution<true>(1 << m, cnt);
    long long ans = 0;
    for (int i = 0; i < (1 << m); ++i) {
        if (__builtin_popcount(i) % 2) {
            ans += cnt[i];
        }
    }
    assert(ans % 2 == 0);
    printf("%lld\n", ans / 2);
    return 0;
}

#include <iostream>
using namespace std;

int main() {
  long n,m,k,cou;
  cin>>n>>m;
  k=0;
  string str;
  for(long i=0; i<n; i++){
    cin>>str;
    cou=0;
    for(long j=0; j<m; j++){
      if(str.at(j)=='1'){
        cou++;
      }
    }
    cou=cou%2;
    if(cou==1)k++;
  }
  k=k*(n-k);
  cout<<k;
}
    