#include <bits/stdc++.h>
using namespace std;
const int N = (1 << 20) + 100;
const int NN = 20 + 3;
int dp[2][NN][N];
string s[NN];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  int h = 0;
  for (int i = 0, x; i < m; i++) {
    x = 0;
    for (int j = 0; j < n; j++) {
      x = x * 2 + s[j][i] - '0';
    }
    dp[h][0][x]++;
  }
  for (int i = 0; i < n; i++) {
    h = 1 - h;
    for (int k = 0; k <= i + 1; k++) {
      for (int mask = 0; mask < (1 << n); mask++) {
        dp[h][k][mask] = dp[1 - h][k][mask];
        if (k != 0) {
          dp[h][k][mask] += dp[1 - h][k - 1][mask ^ (1 << i)];
        }
      }
    }
  }
  long long ans = 1LL * n * m;
  for (int mask = 0; mask < (1 << n); mask++) {
    long long tmp = 0;
    for (int j = 0; j <= n; j++) {
      tmp += 1LL * dp[h][j][mask] * min(j, n - j);
    }
    ans = min(ans, tmp);
  }
  cout << ans << "\n";
  return 0;
}
