#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using pi = pair<int, int>;
using ll = long long int;
template <typename T1, typename T2, typename T3>
T1 modpow(T1 _a, T2 p, T3 mod) {
  assert(p >= 0);
  ll ret = 1, a = _a;
  if (a < 0) {
    a %= mod;
    a += mod;
  }
  if (a >= mod) {
    a %= mod;
  }
  for (; p > 0; p /= 2) {
    if (p & 1) ret = ret * a % mod;
    a = a * a % mod;
  }
  return ret;
}
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr auto PI = 3.14159265358979323846L;
constexpr auto oo = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr int mx_n = 21, mx_m = 100005;
constexpr int mx_mask = (1 << mx_n);
string table[mx_n];
int n, m;
int col[mx_m];
int sum[mx_n][mx_mask], cnt[mx_mask];
int main() {
  cin >> n >> m;
  for (int i = ((0)), _i = ((n)-1); i <= _i; ++i) cin >> table[i];
  for (int j = ((0)), _j = ((m)-1); j <= _j; ++j) {
    for (int i = ((0)), _i = ((n)-1); i <= _i; ++i)
      col[j] |= ((table[i][j] - '0') << i);
    ;
  }
  for (int j = ((0)), _j = ((m)-1); j <= _j; ++j) ++sum[0][col[j]];
  for (int k = (1), _k = (n); k <= _k; ++k) {
    for (int mask = ((0)), _mask = (((1 << n)) - 1); mask <= _mask; ++mask) {
      ll cur = 0;
      for (int p = ((0)), _p = ((n)-1); p <= _p; ++p) {
        cur += sum[k - 1][(mask ^ (1 << p))];
        if (k - 2 >= 0) cur -= sum[k - 2][mask];
      }
      cur /= k;
      sum[k][mask] = cur;
      if (k - 2 >= 0) sum[k][mask] += sum[k - 2][mask];
      cnt[mask] += min(k, n - k) * cur;
      ;
    }
  }
  int ans = *min_element(cnt, cnt + (1 << n));
  ;
  cout << ans << endl;
  return 0;
}
