#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int M = 1e5 + 10;
char s[M];
int a[M];
void fft(vector<long long>& A, int low, int high) {
  if (low + 1 == high) return;
  int len = (high - low) / 2, mid = low + len;
  fft(A, low, mid);
  fft(A, mid, high);
  for (int i = low; i < mid; ++i) {
    long long x = A[i];
    long long y = A[i + len];
    A[i] = x - y;
    A[i + len] = x + y;
  }
}
void inv_fft(vector<long long>& A, int low, int high) {
  if (low + 1 == high) return;
  int len = (high - low) / 2, mid = low + len;
  for (int i = low; i < mid; ++i) {
    long long x = A[i];
    long long y = A[i + len];
    A[i] = (x + y) / 2;
    A[i + len] = (y - x) / 2;
  }
  inv_fft(A, low, mid);
  inv_fft(A, mid, high);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    for (int j = 0; j < m; ++j) {
      a[j] |= (s[j] == '1') << i;
    }
  }
  int k = 1 << n;
  vector<long long> A(k), B(k);
  for (int i = 0; i < m; ++i) {
    A[a[i]]++;
  }
  for (int i = 0; i < k; ++i) {
    int cnt = __builtin_popcount(i);
    B[i] = min(cnt, n - cnt);
  }
  fft(A, 0, k);
  fft(B, 0, k);
  for (int i = 0; i < k; ++i) A[i] *= B[i];
  inv_fft(A, 0, k);
  printf("%I64d\n", *min_element(A.begin(), A.end()));
  return 0;
}
