#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100 * 1000 + 19;
const int MASK = 20;
const int inf = 2e9 + 19;
long long n, m, dp[1 << MASK][MASK + 1];
string s[MAX_N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < m; i++) {
    long long tmp = 0;
    for (int j = 0; j < n; j++) tmp += ((1 << j) * (s[j][i] == '1'));
    dp[tmp][0]++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i; j >= 1; j--) {
      for (int mask = 0; mask < (1 << n); mask++)
        dp[mask][j] += dp[mask ^ (1 << (i - 1))][j - 1];
    }
  }
  long long ans = inf;
  for (int mask = 0; mask < (1 << n); mask++) {
    long long sum = 0;
    for (long long j = 0; j <= n; j++) sum += dp[mask][j] * min(j, n - j);
    ans = min(ans, sum);
  }
  cout << ans;
  return (0);
}
