#include <bits/stdc++.h>
using namespace std;
const int N = (1 << 20) + 10;
long long f[N], hs[N], g[N];
int n, m, S;
char s[25][100100];
inline void FWT(long long *f, int tp = 0) {
  long long x, y;
  for (int m = 1; m < S; m <<= 1)
    for (int i = 0; i < S; i += m << 1)
      for (int j = 0; j < m; ++j) {
        x = f[i + j], y = f[i + j + m];
        f[i + j] = x + y, f[i + j + m] = x - y;
        if (tp) f[i + j] >>= 1, f[i + j + m] >>= 1;
      }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0, nn = int(n); i < nn; ++i) scanf("%s", s[i]);
  int tw;
  for (int i = 0, nn = int(m); i < nn; ++i) {
    tw = 0;
    for (int j = 0, nn = int(n); j < nn; ++j) tw = tw | (s[j][i] - '0') << j;
    ++f[tw];
  }
  hs[0] = 0;
  int as = n * m;
  S = 1 << n;
  for (int i = int(1), nn = int(S - 1); i <= nn; ++i)
    hs[i] = hs[i ^ (i & (-i))] + 1;
  for (int i = 0, nn = int(S); i < nn; ++i) g[i] = min(hs[i], n - hs[i]);
  FWT(g), FWT(f);
  for (int i = 0, nn = int(S); i < nn; ++i) f[i] = f[i] * g[i];
  FWT(f, 1);
  for (int i = 0, nn = int(S); i < nn; ++i) as = f[i] < as ? f[i] : as;
  return printf("%d\n", as), 0;
}
