#include <bits/stdc++.h>
using namespace std;
const int N = 1050000, P = 998244353, inv2 = (P + 1) / 2;
int n, m, U, cnt[N], f[N], g[N], ans;
char s[21][100005];
inline void read(int &i) {
  i = 0;
  char c = getchar();
  bool j = 0;
  for (; !isdigit(c); c = getchar())
    if (c == '-') j = 1;
  for (; isdigit(c); c = getchar()) i = (i << 1) + (i << 3) + c - '0';
  i = j ? -i : i;
}
void FWT(int *a, int l, int p) {
  for (int i = 1; i < l; i <<= 1) {
    for (int j = 0; j < l; j += i << 1) {
      for (int k = 0; k < i; ++k) {
        int x = a[j + k], y = a[i + j + k];
        a[j + k] = (x + y) % P;
        a[i + j + k] = (x - y + P) % P;
        if (p == -1)
          a[j + k] = 1ll * a[j + k] * inv2 % P,
                a[i + j + k] = 1ll * a[i + j + k] * inv2 % P;
      }
    }
  }
}
int main() {
  read(n);
  read(m);
  ans = n * m;
  U = (1 << n) - 1;
  for (int i = 1; i <= n; ++i) scanf("%s", s[i] + 1);
  for (int j = 1; j <= m; ++j) {
    int x = 0;
    for (int i = 1; i <= n; ++i)
      if (s[i][j] == '1') x ^= 1 << (n - i);
    f[x]++;
  }
  for (int i = 1; i <= U; ++i) cnt[i] = cnt[i >> 1] + (i & 1);
  for (int i = 0; i <= U; ++i) g[i] = min(cnt[i], n - cnt[i]);
  FWT(f, U, 1);
  FWT(g, U, 1);
  for (int i = 0; i <= U; ++i) f[i] = 1ll * f[i] * g[i] % P;
  FWT(f, U, -1);
  for (int i = 0; i <= U; ++i) ans = min(ans, f[i]);
  printf("%d\n", ans);
  return 0;
}
