#include <bits/stdc++.h>
using namespace std;
namespace Dango {
const int MAXN = 25, MAXM = 100005;
string st;
int n, m;
int num[MAXM];
int dp[MAXN][(1 << 20) + 5];
int ans;
int work() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> st;
    for (int j = 0; j < st.length(); j++)
      num[j + 1] = (num[j + 1] << 1) + (st[j] - '0');
  }
  for (int i = 1; i <= m; i++) dp[0][num[i]]++;
  for (int i = 0; i < n; i++)
    for (int j = n; j >= 1; j--)
      for (int k = 0; k < (1 << n); k++) dp[j][k] += dp[j - 1][k ^ (1 << i)];
  ans = n * m;
  for (int i = 0; i < (1 << n); i++) {
    int res = 0;
    for (int j = 0; j <= n; j++) res += dp[j][i] * min(j, n - j);
    ans = min(ans, res);
  }
  cout << ans;
  return 0;
}
}  // namespace Dango
int main() { return Dango::work(); }
