#include <bits/stdc++.h>
using namespace std;
const int N = (1 << 20) + 3;
int n, m, lim = 1;
long long f[N], g[N];
char s[21][100010];
inline void fwt(long long *t, int op) {
  for (int mid = 1; mid < lim; mid <<= 1)
    for (int r = mid << 1, j = 0; j < lim; j += r)
      for (int k = 0; k < mid; k++) {
        long long x = t[j + k], y = t[j + k + mid];
        if (op == 1)
          t[j + k] = x + y, t[j + k + mid] = x - y;
        else
          t[j + k] = (x + y) / 2, t[j + k + mid] = (x - y) / 2;
      }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0, lit = 1 << n; i < lit; i++)
    g[i] = min(__builtin_popcount(i), n - __builtin_popcount(i));
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  for (int i = 1; i <= m; i++) {
    int res = 0;
    for (int j = 1; j <= n; j++)
      if (s[j][i] == '1') res |= 1 << (j - 1);
    f[res]++;
  }
  lim = 1 << n;
  fwt(f, 1), fwt(g, 1);
  for (int i = 0; i < lim; i++) f[i] = f[i] * g[i];
  fwt(f, -1);
  long long ans = 1ll << 60;
  for (int i = 0, lit = 1 << n; i < lit; i++) ans = min(ans, f[i]);
  printf("%lld\n", ans);
  return 0;
}
