#include <bits/stdc++.h>
using namespace std;
long long n, m, nn, one[(1 << 20) + 10], a[(1 << 20) + 10], b[(1 << 20) + 10];
string s[(1 << 20) + 10];
void solveinit() {
  for (long long i = 1; i < nn; i++) {
    if (i % 2 == 0) one[i] = one[i >> 1];
    if (i % 2 == 1) one[i] = one[i >> 1] + 1;
  }
  for (long long i = 0; i < nn; i++) {
    b[i] = min(one[i], n - one[i]);
  }
}
void FWT(long long now[(1 << 20) + 10], long long l, long long r) {
  if (l == r) return;
  FWT(now, l, ((l + r) >> 1) + 0);
  FWT(now, ((l + r) >> 1) + 1, r);
  long long lpo = l, rpo = ((l + r) >> 1) + 1;
  while (lpo <= ((l + r) >> 1)) {
    now[lpo] = now[lpo] + now[rpo];
    now[rpo] = now[lpo] - now[rpo] - now[rpo];
    lpo++, rpo++;
  }
}
void IFWT(long long now[(1 << 20) + 10], long long l, long long r) {
  if (l == r) return;
  long long lpo = l, rpo = ((l + r) >> 1) + 1;
  while (lpo <= ((l + r) >> 1)) {
    now[lpo] = (now[lpo] + now[rpo]) / 2;
    now[rpo] = now[lpo] - now[rpo];
    lpo++, rpo++;
  }
  IFWT(now, l, ((l + r) >> 1) + 0);
  IFWT(now, ((l + r) >> 1) + 1, r);
}
int32_t main() {
  cin.tie(0), cout.sync_with_stdio(0);
  cin >> n >> m;
  for (long long i = 0; i < n; i++) cin >> s[i];
  for (long long i = 0; i < m; i++) {
    long long val = 0;
    for (long long j = 0; j < n; j++) val = val * 2 + s[j][i] - '0';
    a[val]++;
  }
  nn = (1 << n);
  solveinit();
  FWT(a, 0, nn - 1), FWT(b, 0, nn - 1);
  for (long long i = 0; i < nn; i++) a[i] = a[i] * b[i];
  IFWT(a, 0, nn - 1);
  long long ans = n * m + 10;
  for (long long i = 0; i < nn; i++) ans = min(ans, a[i]);
  cout << ans << endl;
  return 0;
}
