#include <bits/stdc++.h>
using namespace std;
const long long N = (1 << 20) + 9, M = 1e5 + 9;
long long n, m, f[N], g[N], a[M], num[N];
char s[M];
inline void FWT(long long *f, long long flag) {
  for (long long mid = 2, k = 1; mid <= n; mid <<= 1, k <<= 1)
    for (long long i = 0; i < n; i += mid)
      for (long long j = 0; j < k; j++)
        f[i + j] += f[i + j + k],
            f[i + j + k] = f[i + j] - f[i + j + k] - f[i + j + k],
                      f[i + j] /= flag, f[i + j + k] /= flag;
}
signed main() {
  scanf("%lld%lld", &n, &m);
  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++) num[i] = num[i >> 1] + (i & 1);
  for (long long i = 0; i < (1 << n); i++) g[i] = min(num[i], n - num[i]);
  n = (1 << n);
  FWT(f, 1), FWT(g, 1);
  for (long long i = 0; i < n; i++) f[i] *= g[i];
  FWT(f, 2);
  long long ans = 1e15;
  for (long long i = 0; i < n; i++) ans = min(ans, f[i]);
  printf("%lld", ans);
  return 0;
}
