#include <bits/stdc++.h>
using namespace std;
int n, m, t;
char S[25][100005];
long long f[1048576], dp[1048576];
int ans;
inline void Read(int &p) {
  p = 0;
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    ;
  for (; c >= '0' && c <= '9'; c = getchar()) p = p * 10 + c - '0';
}
inline void XorFWT(int n, long long *A) {
  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] + A[j + k + i];
        long long y = A[j + k] - A[j + k + i];
        A[j + k] = x, A[j + k + i] = y;
      }
    }
  }
}
inline void XorIFWT(int n, long long *A) {
  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] + A[j + k + i];
        long long y = A[j + k] - A[j + k + i];
        A[j + k] = x / 2;
        A[j + k + i] = y / 2;
      }
    }
  }
}
inline void mul(long long *A, long long *B, int w) {
  for (int i = 0; i < w; i++) A[i] = A[i] * B[i];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", S[i] + 1);
  for (int i = 1; i <= m; i++) {
    int v = 0;
    for (int j = 1; j <= n; j++) v = v * 2 + S[j][i] - '0';
    f[v]++;
  }
  for (int i = 1; i < (1 << n); i++) dp[i] = dp[i - (i & -i)] + 1;
  for (int i = 0; i < (1 << n); i++) dp[i] = min(dp[i], n - dp[i]);
  XorFWT(1 << n, f);
  XorFWT(1 << n, dp);
  mul(f, dp, 1 << n);
  XorIFWT(1 << n, f);
  ans = n * m;
  for (int i = 0; i < (1 << n); i++) ans = min(ans, int(f[i]));
  printf("%d\n", ans);
}
