#include <bits/stdc++.h>
using namespace std;
const int mxn = 1048576;
int n, m, len;
long long a[mxn], b[mxn], ans;
char s[21][131072];
void FWT(long long *a, bool flg) {
  for (int i = 1; i <= len >> 1; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = j; k < j + i; ++k) {
        long long x = a[k], y = a[k + i];
        a[k] = x + y, a[k + i] = x - y;
        if (flg) a[k] /= 2, a[k + i] /= 2;
      }
}
int main() {
  scanf("%d%d", &n, &m), len = 1 << n, ans = n * m;
  for (int i = 1; i <= n; ++i) scanf("%s", s[i]);
  for (int i = 0; i < m; ++i) {
    int num = 0;
    for (int j = 1; j <= n; ++j) num |= (s[j][i] - 48) << (j - 1);
    ++a[num];
  }
  for (int i = 0; i < len; ++i) {
    for (int j = 0; j < n; ++j) b[i] += (i & (1 << j)) != 0;
    b[i] = min(b[i], n - b[i]);
  }
  FWT(a, 0), FWT(b, 0);
  for (int i = 0; i < len; ++i) a[i] *= b[i];
  FWT(a, 1);
  for (int i = 0; i < len; ++i) ans = min(ans, a[i]);
  printf("%I64d\n", ans);
  return 0;
}
