#include <bits/stdc++.h>
using namespace std;
class FWT {
 public:
  void fwt(long long *a, int n) {
    for (int d = 1; d < n; d <<= 1) {
      for (int m = d << 1, i = 0; i < n; i += m) {
        for (int j = 0; j < d; j++) {
          long long x = a[i + j], y = a[i + j + d];
          a[i + j] = x + y;
          a[i + j + d] = x - y;
        }
      }
    }
  }
  void ufwt(long long *a, int n) {
    for (int d = 1; d < n; d <<= 1) {
      for (int m = d << 1, i = 0; i < n; i += m) {
        for (int j = 0; j < d; j++) {
          long long x = a[i + j], y = a[i + j + d];
          a[i + j] = (x + y) / 2;
          a[i + j + d] = (x - y) / 2;
        }
      }
    }
  }
  void work(long long *a, long long *b, int n) {
    fwt(a, n);
    fwt(b, n);
    for (int i = 0; i < n; i++) a[i] *= b[i];
    ufwt(a, n);
  }
} myfwt;
const int maxn = 100086;
char str[maxn];
long long dp[(1 << 20) + 5], num[(1 << 20) + 5], a[maxn];
int n, m;
int calc(int x) {
  int ans = 0;
  for (; x; x >>= 1) ans += (x & 1);
  return ans;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> str;
    for (int j = 0; j < m; j++) a[j] |= ((str[j] - '0') << i);
  }
  for (int i = 0; i < m; i++) num[a[i]]++;
  for (int i = 0; i < (1 << n); i++) {
    int ans = calc(i);
    dp[i] = min(ans, n - ans);
  }
  myfwt.work(dp, num, 1 << n);
  long long ans = 1e18;
  for (int i = 0; i < (1 << n); i++) ans = min(ans, dp[i]);
  cout << ans << endl;
  return 0;
}
