#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char c = getchar();
  long long x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
long long n, m, s, cnt[1400205], f[1400205];
bool g[21][100005];
inline void fwtxor(long long *f, long long n, long long x) {
  for (long long l = 2, k = 1; l <= n; l <<= 1, k <<= 1)
    for (long long i = 0; i < n; i += l)
      for (long long j = 0; j < k; ++j) {
        long long a = f[i + j], b = f[i + j + k];
        f[i + j] = (a + b) / x, f[i + j + k] = (a - b) / x;
      }
}
signed main() {
  n = read(), m = read(), s = 1 << n;
  for (register long long i = (1); i <= (n); ++i)
    for (register long long j = (1); j <= (m); ++j) {
      char ch;
      cin >> ch;
      g[i][j] = (ch - '0');
    }
  for (register long long i = (1); i <= (m); ++i) {
    long long sta = 0;
    for (register long long j = (1); j <= (n); ++j)
      sta |= (1 << (j - 1)) * g[j][i];
    f[sta]++;
  }
  for (register long long i = (0); i <= (s - 1); ++i)
    cnt[i] = cnt[i >> 1] + (i & 1);
  for (register long long i = (0); i <= (s - 1); ++i)
    cnt[i] = min(cnt[i], n - cnt[i]);
  fwtxor(f, s, 1), fwtxor(cnt, s, 1);
  for (register long long i = (0); i <= (s - 1); ++i) f[i] *= cnt[i];
  fwtxor(f, s, 2);
  long long res = INT_MAX;
  for (register long long i = (0); i <= (s - 1); ++i) res = min(res, f[i]);
  cout << res;
  return 0;
}
