#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
inline string get() {
  char ch[2000010];
  scanf("%s", ch);
  return ch;
}
inline void read(int *a, int n) {
  for (int i = 0; i < n; i++) a[i] = in();
}
template <class blank>
inline void out(blank x) {
  cout << x << "\n";
  exit(0);
}
const int maxn = 1e5 + 10;
const int maxm = 1e6 + 10;
const int maxlg = 21;
const int base = 29;
const int mod = 1e9 + 7;
const int INF = 1e9 + 10;
const int SQ = 317 + 5;
int a[21][maxn];
int dp[21][1 << 20], dp2[21][1 << 20];
int res = INF;
int32_t main() {
  int n = in(), m = in();
  for (int i = 0; i < n; i++) {
    string s = get();
    for (int j = 0; j < m; j++) a[i][j] = s[j] == '1';
  }
  for (int j = 0; j < m; j++) {
    int mask = 0;
    for (int i = 0; i < n; i++) mask |= a[i][j] << i;
    dp[0][mask]++;
  }
  for (int bit = 0; bit < n; bit++)
    for (int cnt = n; cnt >= 1; cnt--)
      for (int mask = 0; mask < (1 << n); mask++) {
        dp[cnt][mask] += dp[cnt - 1][mask ^ (1 << bit)];
      }
  for (int mask = 0; mask < (1 << n); mask++) {
    int tot = 0;
    for (int pt = 0; pt <= n; pt++) tot += min(pt, n - pt) * dp[pt][mask];
    res = min(res, tot);
  }
  cout << res << "\n";
}
