#include <bits/stdc++.h>
using namespace std;
long long a[1 << 20], b[1 << 20], ans;
char s[20][1 << 20];
int bit[1 << 20], now, k, n, m, i, N;
void FWT(long long *a, int o) {
  for (int i = 1; i < N; i <<= 1)
    for (int j = 0; j < N; j += i << 1)
      for (int k = 0; k < i; k++) {
        long long x = a[j + k + i], y = a[j + k];
        a[j + k] = y + x;
        a[j + k + i] = y - x;
        if (o) a[j + k] >>= 1, a[j + k + i] >>= 1;
      }
}
int main() {
  scanf("%d%d", &n, &m);
  N = 1 << n;
  for (i = 0; i < n; i++) scanf("%s", s[i]);
  for (k = 0; k < m; a[now]++, k++)
    for (i = now = 0; i < n; i++) now |= (1 << i) * (s[i][k] == '1');
  for (i = 0; i < N; i++) bit[i] = bit[i >> 1] + (i & 1);
  for (i = 0; i < N; i++) b[i] = min(bit[i], bit[(N - 1) ^ i]);
  FWT(a, 0);
  FWT(b, 0);
  for (i = 0; i < N; i++) a[i] *= b[i];
  FWT(a, 1);
  ans = a[1];
  for (i = 1; i < (1 << n); i++) ans = min(ans, a[i]);
  printf("%I64d\n", ans);
}
