#include <bits/stdc++.h>
using namespace std;
int dp[22][1111111], a[2222222], n, m, ans;
char c;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      cin >> c, a[j] += (1 << i) * (c - '0'), ans += (c - '0');
  for (int i = 0; i < m; i++) dp[0][a[i]]++;
  for (int i = 0; i < n; i++)
    for (int j = n; j; j--)
      for (int mask = 0; mask < (1 << n); mask++)
        dp[j][mask] += dp[j - 1][mask ^ (1 << i)];
  for (int mask = (1 << n) - 1; mask >= 0; mask--) {
    int cur = 0;
    for (int i = 0; i <= n; i++) cur += min(i, n - i) * dp[i][mask];
    ans = min(ans, cur);
  }
  cout << ans;
}
