#include <bits/stdc++.h>
using namespace std;
namespace _ {
bool rEOF = 1;
inline char nc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && rEOF &&
                 (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? (rEOF = 0, EOF)
             : *p1++;
}
template <class _T>
inline bool read(_T &num) {
  char c = nc(), f = 1;
  num = 0;
  while (c < '0' || c > '9') c == '-' && (f = -1), c = nc();
  while (c >= '0' && c <= '9') num = num * 10 + c - '0', c = nc();
  return (bool)(num *= f);
}
inline bool need(char &c) {
  return c >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c >= 'A' && c <= 'Z';
}
inline bool read_str(char *a) {
  while ((*a = nc()) && need(*a) && rEOF) ++a;
  *a = '\0';
  return rEOF;
}
}  // namespace _
using namespace _;
const int mod = 1e9 + 7;
const int maxm = (1 << 10) + 5;
vector<int> v[maxm];
int dp[maxm][maxm];
int ans[maxm];
int a[maxm];
int tmp[maxm];
int n, m;
int inv2 = 500000004;
void fwt(int *a, int N, int opt) {
  for (int i = 1; i < N; i <<= 1)
    for (int p = i << 1, j = 0; j < N; j += p)
      for (int k = 0; k < i; ++k) {
        int X = a[j + k], Y = a[i + j + k];
        a[j + k] = (X + Y) % mod;
        a[i + j + k] = (X + mod - Y) % mod;
        if (opt == -1)
          a[j + k] = 1ll * a[j + k] * inv2 % mod,
                a[i + j + k] = 1ll * a[i + j + k] * inv2 % mod;
      }
}
char aa[22][100005];
int b[100005];
int x[(1 << 20) + 5];
int y[(1 << 20) + 5];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", aa[i]);
  for (int i = 0; i < m; i++) {
    b[i] = 0;
    for (int j = 0; j < n; j++) b[i] |= ((aa[j][i] - '0') << j);
  }
  for (int i = 0; i < m; i++) x[b[i]]++;
  int len = 1 << n;
  for (int i = 0; i < len; i++) {
    int tt = __builtin_popcount(i);
    y[i] = min(tt, n - tt);
  }
  fwt(x, len, 1);
  fwt(y, len, 1);
  for (int i = 0; i < len; i++) x[i] = 1ll * y[i] * x[i] % mod;
  fwt(x, len, -1);
  int ans = n * m;
  for (int i = 0; i < len; i++) ans = min(ans, x[i]);
  printf("%d\n", ans);
}
