#include <bits/stdc++.h>
using namespace std;
const int N = 1050000;
const int M = 100010;
int n, m, lim;
long long ans;
long long a[N], b[N];
int g[M], cnt[N];
char ch[M];
void fwt(long long *a) {
  for (int l = 2, m = 1; l <= lim; m = l, l <<= 1)
    for (int i = 0; i < lim; i += l)
      for (int j = 0; j < m; j++) {
        long long x = a[i + j], y = a[i + j + m];
        a[i + j] = (x + y);
        a[i + j + m] = (x - y);
      }
}
void ifwt(long long *a) {
  for (int l = 2, m = 1; l <= lim; m = l, l <<= 1)
    for (int i = 0; i < lim; i += l)
      for (int j = 0; j < m; j++) {
        long long x = a[i + j], y = a[i + j + m];
        a[i + j] = (x + y) >> 1;
        a[i + j + m] = (x - y) >> 1;
      }
}
int main() {
  scanf("%d%d", &n, &m);
  lim = 1 << n;
  for (int i = 1; i <= n; i++) {
    scanf("%s", ch + 1);
    for (int j = 1; j <= m; j++)
      if (ch[j] == '1') g[j] |= 1 << (i - 1);
  }
  for (int i = 1; i <= m; i++) a[g[i]]++;
  for (int i = 0; i < lim; i++) cnt[i] = cnt[i >> 1] + (i & 1);
  for (int i = 0; i < lim; i++) b[i] = min(cnt[i], n - cnt[i]);
  fwt(a);
  fwt(b);
  for (int i = 0; i < lim; i++) a[i] = a[i] * b[i];
  ifwt(a);
  ans = n * m;
  for (int i = 0; i < lim; i++) ans = min(ans, a[i]);
  printf("%lld\n", ans);
  return 0;
}
