#include <bits/stdc++.h>
using namespace std;
const long long maxn = 21;
const long long maxm = 100010;
const long long inf = 1e18;
long long n, m, ans = inf;
long long a[maxm], size[1 << maxn], f[1 << maxn], g[1 << maxn];
char s[maxm];
inline long long read() {
  char c = getchar();
  long long res = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar();
  return res * f;
}
inline void FWT(long long *a, long long n, long long op) {
  for (long long l = 1; l < (1 << n); l <<= 1)
    for (long long i = 0; i < (1 << n); i += l << 1)
      for (long long j = 0; j < l; j++) {
        long long x = a[i + j], y = a[i + l + j];
        if (~op)
          a[i + j] = x + y, a[i + l + j] = x - y;
        else
          a[i + j] = (x + y) >> 1, a[i + l + j] = (x - y) >> 1;
      }
}
signed main() {
  n = read(), m = read();
  for (long long i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    for (long long j = 1; j <= m; j++)
      if (s[j] == '1') a[j] |= 1 << i - 1;
  }
  for (long long i = 1; i <= m; i++) f[a[i]]++;
  for (long long i = 0; i < (1 << n); i++) size[i] = size[i >> 1] + (i & 1);
  for (long long i = 0; i < (1 << n); i++) g[i] = min(size[i], n - size[i]);
  FWT(f, n, 1);
  FWT(g, n, 1);
  for (long long i = 0; i < (1 << n); i++) f[i] *= g[i];
  FWT(f, n, -1);
  for (long long i = 0; i < (1 << n); i++) ans = min(ans, f[i]);
  printf("%lld", ans);
  return 0;
}
