#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 10, N = 20 + 1;
char s[M];
int clm[M], dp[N][1 << N];
int n, m, cnt;
int toInt(char c) { return (int)(c - '0'); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int j = 0; j < m; j++) clm[j] |= toInt(s[j]) << i;
  }
  for (int i = 0; i < m; i++) dp[0][clm[i]]++;
  for (int k = 1; k <= n; k++)
    for (int mask = 0; mask < (1 << n); mask++) {
      int sum = 0;
      if (k > 1) sum = (k - 2 - n) * dp[k - 2][mask];
      for (int j = 0; j < n; j++) sum += dp[k - 1][mask ^ (1 << j)];
      dp[k][mask] = sum / k;
    }
  cnt = m * n;
  for (int mask = 0; mask < (1 << n); mask++) {
    int tmp = 0;
    for (int k = 0; k <= n; k++) tmp += min(k, n - k) * dp[k][mask];
    cnt = min(cnt, tmp);
  }
  return cout << cnt, 0;
}
