#include <bits/stdc++.h>
using namespace std;
int n, m, c[1048576];
char s[20][1048576];
long long A[1048576], B[1048576], d;
inline void fwt(long long* s, int o) {
  o = 2 - o;
  long long x, y;
  for (int i = 1; i <= 1048576; i <<= 1)
    for (int j = i; j < 1048576; ++j& i ? 0 : j |= i) {
      x = s[i ^ j];
      y = s[j];
      s[i ^ j] = (x + y) / o;
      s[j] = (x - y) / o;
    }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%s", s[i] + 1);
  for (int i = 1; i <= m; ++i) {
    int k = 0;
    for (int j = 0; j < n; ++j) k = (k << 1) | (s[j][i] ^ 48);
    ++A[k];
  }
  for (int i = 1; i < 1048576; ++i) c[i] = c[i >> 1] + (i & 1);
  for (int i = 0; i < 1048576; ++i) B[i] = min(c[i], c[(1 << n) - 1 ^ i]);
  fwt(A, 1);
  fwt(B, 1);
  for (int i = 0; i < 1048576; ++i) A[i] *= B[i];
  fwt(A, 0);
  for (int i = 1; i < 1048576; ++i) A[0] = min(*A, A[i]);
  printf("%d\n", A[0]);
}
