#include <bits/stdc++.h>
using namespace std;
int n, m, tmp[100010];
long long ans, num[1100000], cnt[1100000];
void FWT(long long sz[], int siz) {
  static int x, y;
  for (int i = 1; i < siz; i <<= 1)
    for (int j = 0; j < siz; j += (i << 1))
      for (int k = 0; k < i; ++k) {
        x = sz[j + k], y = sz[j + i + k];
        sz[j + k] = x + y, sz[j + i + k] = x - y;
      }
}
void UFWT(long long sz[], int siz) {
  for (int i = 1; i < siz; i <<= 1)
    for (int j = 0; j < siz; j += (i << 1))
      for (int k = 0; k < i; ++k) {
        sz[j + k] = (sz[j + k] + sz[j + i + k]) >> 1;
        sz[j + i + k] = sz[j + k] - sz[j + i + k];
      }
}
int main() {
  scanf("%d%d", &n, &m);
  getchar();
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) tmp[j] = (tmp[j] << 1) + getchar() - '0';
    getchar();
  }
  for (int i = 1; i <= m; ++i) ++num[tmp[i]];
  for (int i = 1; i < (1 << n); ++i) cnt[i] = cnt[i - (i & -i)] + 1;
  for (int i = 1; i < (1 << n); ++i) cnt[i] = min(cnt[i], n - cnt[i]);
  FWT(num, 1 << n);
  FWT(cnt, 1 << n);
  for (int i = 0; i < (1 << n); ++i) cnt[i] *= num[i];
  UFWT(cnt, 1 << n);
  ans = 1 << 21;
  for (int i = 0; i < (1 << n); ++i) ans = min(cnt[i], ans);
  printf("%I64d", ans);
}
