#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005, MAXS = 1048580;
long long ans, res[MAXS], cnt[MAXS];
int n, m, s, a[MAXN];
int read() {
  char ch = getchar();
  while (ch < '0' || ch > '1') ch = getchar();
  return ch - '0';
}
int lowbit(int x) { return x & (-x); }
int count(int x) {
  int tot = 0;
  for (; x; x -= lowbit(x)) tot++;
  return tot;
}
void FWT(long long *C, int len, int on) {
  for (int h = 2; h <= len; h <<= 1)
    for (int j = 0; j < len; j += h)
      for (int k = j; k < j + h / 2; k++) {
        long long x = C[k], y = C[k + h / 2];
        C[k] = x + y, C[k + h / 2] = x - y;
        if (on == -1) C[k] /= 2, C[k + h / 2] /= 2;
      }
}
int main() {
  scanf("%d%d", &n, &m);
  s = 1 << n;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) a[j] = a[j] * 2 + read();
  for (int i = (1); i <= (m); i++) cnt[a[i]]++;
  for (int i = (0); i <= (s - 1); i++) {
    int x = count(i);
    res[i] = min(x, n - x);
  }
  FWT(res, s, 1);
  FWT(cnt, s, 1);
  for (int i = (0); i <= (s - 1); i++) res[i] *= cnt[i];
  FWT(res, s, -1);
  ans = n * m;
  for (int i = (0); i <= (s - 1); i++) ans = min(ans, res[i]);
  printf("%I64d\n", ans);
  return 0;
}
