#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
void qread(int &x) {
  int neg = 1;
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = 10 * x + c - '0', c = getchar();
  x *= neg;
}
const int maxn = 21;
const int maxm = 100005;
const int maxs = 1 << 20;
int n, m;
char c[maxn][maxm];
int dp[maxn][maxs];
int main() {
  scanf("%d%d", &n, &m);
  for (int(i) = 0; (i) < n; i++) scanf("%s", c[i]);
  for (int(j) = 0; (j) < m; j++) {
    int cur = 0;
    for (int(i) = 0; (i) < n; i++) cur = cur << 1 | (c[i][j] - '0');
    dp[0][cur]++;
  }
  for (int(i) = 1; (i) <= n; i++)
    for (int(mask) = 0; (mask) < 1 << n; mask++) {
      long long sum = i < 2 ? 0 : 1LL * (i - 2 - n) * dp[i - 2][mask];
      for (int(j) = 0; (j) < n; j++) sum += dp[i - 1][mask ^ (1 << j)];
      dp[i][mask] = sum / i;
    }
  int ans = n * m;
  for (int(mask) = 0; (mask) < 1 << n; mask++) {
    int cur = 0;
    for (int(i) = 0; (i) < n + 1; i++) cur += dp[i][mask] * min(i, n - i);
    ans = min(ans, cur);
  }
  printf("%d\n", ans);
  return 0;
}
