#include <bits/stdc++.h>
using namespace std;
unsigned int n, m;
unsigned int dp[21][1 << 20];
char t[20][100009];
int main() {
  scanf("%u %u", &n, &m);
  for (unsigned int i = 0; i < n; i++) scanf(" %s", t[i]);
  for (unsigned int i = 0; i < m; i++) {
    unsigned int mask = 0;
    for (unsigned int j = 0; j < n; j++)
      if (t[j][i] == '1') mask |= (1 << j);
    dp[0][mask]++;
  }
  unsigned int MAX_N = (1 << n);
  for (unsigned int k = 1; k <= n; k++) {
    for (unsigned int mask = 0; mask < MAX_N; mask++) {
      for (unsigned int p = 0; p < n; p++)
        dp[k][mask] += dp[k - 1][mask ^ (1 << p)];
      if (k > 1) dp[k][mask] += (k - 2 - n) * dp[k - 2][mask];
      dp[k][mask] /= k;
    }
  }
  unsigned int answ = m * n;
  for (unsigned int mask = 0; mask < MAX_N; mask++) {
    unsigned int tmpansw = 0;
    for (unsigned int k = 0; k <= n; k++) {
      tmpansw += min(k, n - k) * dp[k][mask];
    }
    answ = min(tmpansw, answ);
  }
  cout << answ << endl;
  return 0;
}
