#include <bits/stdc++.h>
using namespace std;
const int N = 100002;
int n, m;
int c[N];
int dp[1 << 20][20];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      int x;
      scanf("%1d", &x);
      c[j] |= x << i;
    }
  for (int i = 0; i < m; ++i) dp[c[i]][0] += 1;
  for (int k = 1; k <= n; ++k)
    for (int mask = 0; mask < (1 << n); ++mask) {
      int& res = dp[mask][k];
      if (k > 1) res += (k - 2 - n) * dp[mask][k - 2];
      for (int i = 0; i < n; ++i) res += dp[mask ^ (1 << i)][k - 1];
      res /= k;
    }
  int ans = n * m;
  for (int mask = 0; mask < (1 << n); ++mask) {
    int lans = 0;
    for (int k = 0; k <= n; ++k) lans += min(k, n - k) * dp[mask][k];
    ans = min(ans, lans);
  }
  printf("%d\n", ans);
  return 0;
}
