#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
vl mult(vl& a, vl& b) {
  assert(a.size() == b.size());
  if (a.size() == 1) return {a[0] * b[0]};
  vl a0(a.begin(), a.begin() + a.size() / 2),
      a1(a.begin() + a.size() / 2, a.begin() + a.size());
  vl as(a.size() / 2), ad(a.size() / 2);
  for (int i = (0); i < (a.size() / 2); i++)
    as[i] = a0[i] + a1[i], ad[i] = a0[i] - a1[i];
  vl b0(b.begin(), b.begin() + b.size() / 2),
      b1(b.begin() + b.size() / 2, b.begin() + b.size());
  vl bs(b.size() / 2), bd(b.size() / 2);
  for (int i = (0); i < (b.size() / 2); i++)
    bs[i] = b0[i] + b1[i], bd[i] = b0[i] - b1[i];
  vl x0 = mult(as, bs), x1 = mult(ad, bd), ans(a.size());
  for (int i = (0); i < (a.size() / 2); i++) ans[i] = (x0[i] + x1[i]) / 2;
  for (int i = (0); i < (a.size() / 2); i++)
    ans[i + a.size() / 2] = (x0[i] - x1[i]) / 2;
  return ans;
}
string tp[20];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vl a(1 << n), b(1 << n);
  for (int i = (0); i < (n); i++) cin >> tp[i];
  for (int i = (0); i < (m); i++) {
    string k;
    for (int j = (0); j < (n); j++) k += tp[j][i];
    a[bitset<20>(k).to_ulong()]++;
  }
  for (int i = (0); i < (1 << n); i++) {
    int ppc = __builtin_popcount(i);
    b[i] = min(ppc, n - ppc);
  }
  vl c = mult(a, b);
  ll ans = c[0];
  for (ll& t : c) ans = min(ans, t);
  cout << ans;
}
