#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
void qread(int &x) {
  int neg = 1;
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = 10 * x + c - '0', c = getchar();
  x *= neg;
}
const int maxn = 22;
const int maxm = 100005;
const int maxs = 1 << maxn;
int n, m;
char c[maxn][maxm];
long long a[maxs], b[maxs];
namespace Poly {
void fwt(long long *x, int sz, int tp) {
  for (int m = 2; m <= sz; m <<= 1) {
    for (int i = 0; i < sz; i += m) {
      for (int j = i; j < i + (m >> 1); j++) {
        long long u = x[j], v = x[j + (m >> 1)];
        x[j] = u + v;
        x[j + (m >> 1)] = u - v;
        if (tp < 0) x[j] /= 2, x[j + (m >> 1)] /= 2;
      }
    }
  }
}
}  // namespace Poly
int main() {
  scanf("%d%d", &n, &m);
  for (int(i) = 0; (i) < n; i++) scanf("%s", c[i]);
  for (int(j) = 0; (j) < m; j++) {
    int cur = 0;
    for (int(i) = 0; (i) < n; i++) cur = cur << 1 | (c[i][j] - '0');
    a[cur]++;
  }
  for (int(mask) = 0; (mask) < 1 << n; mask++)
    b[mask] = b[mask >> 1] + (mask & 1);
  for (int(mask) = 0; (mask) < 1 << n; mask++)
    b[mask] = min(b[mask], n - b[mask]);
  Poly::fwt(a, 1 << n + 1, 1);
  Poly::fwt(b, 1 << n + 1, 1);
  for (int(i) = 0; (i) < 1 << n + 1; i++) b[i] *= a[i];
  Poly::fwt(b, 1 << n + 1, -1);
  long long ans = n * m;
  for (int(i) = 0; (i) < 1 << n; i++) ans = min(ans, b[i]);
  printf("%lld\n", ans);
  return 0;
}
