#include <bits/stdc++.h>
using namespace std;
char s[2000005];
long long n, m, lim, ans = 2e15;
long long cnt[2000005], g[2000005];
long long a[2000005], b[2000005];
void FWT(long long *f) {
  for (long long d = 1; d < lim; d <<= 1)
    for (long long i = 0; i < lim; i += (d << 1))
      for (long long j = 0; j < d; j++) {
        long long x = f[i + j], y = f[i + j + d];
        f[i + j] = x + y;
        f[i + j + d] = x - y;
      }
}
void IFWT(long long *f) {
  for (long long d = 1; d < lim; d <<= 1)
    for (long long i = 0; i < lim; i += (d << 1))
      for (long long j = 0; j < d; j++) {
        long long x = f[i + j], y = f[i + j + d];
        f[i + j] = x + y >> 1;
        f[i + j + d] = x - y >> 1;
      }
}
signed main() {
  scanf("%lld%lld", &n, &m);
  lim = 1 << n;
  for (long long i = 0; i < n; i++) {
    scanf("%s", s);
    for (long long j = 0; j < m; j++)
      if (s[j] == '1') g[j] |= (1 << i);
  }
  for (long long i = 0; i < m; i++) a[g[i]]++;
  for (long long i = 1; i < lim; i++) cnt[i] = cnt[i >> 1] + (i & 1);
  for (long long i = 0; i < lim; i++) b[i] = min(cnt[i], n - cnt[i]);
  FWT(a);
  FWT(b);
  for (long long i = 0; i < lim; i++) a[i] *= b[i];
  IFWT(a);
  for (long long i = 0; i < lim; i++) ans = min(ans, a[i]);
  cout << ans;
}
