#include <bits/stdc++.h>
using namespace std;
template <class T, class L>
bool smax(T &x, L y) {
  return x < y ? (x = y, 1) : 0;
}
template <class T, class L>
bool smin(T &x, L y) {
  return y < x ? (x = y, 1) : 0;
}
const int maxn = 20, maxm = 1e5 + 17;
char c[maxm];
int n, m, col[maxm];
int dp[maxn + 1][1 << maxn], ans[1 << maxn];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> c;
    for (int j = 0; j < m; j++) col[j] |= c[j] - '0' << i;
  }
  for (int i = 0; i < m; i++) dp[0][col[i]]++;
  for (int i = 0; i < n; i++)
    for (int k = n; k; k--)
      for (int mask = 0; mask < 1 << n; mask++)
        dp[k][mask] += dp[k - 1][mask ^ (1 << i)];
  int po = 1 << n;
  for (int i = 0; i <= n; i++) {
    int x = min(i, n - i);
    for (int mask = 0; mask < po; mask++) ans[mask] += x * dp[i][mask];
  }
  cout << *min_element(ans, ans + po) << '\n';
  return 0;
}
