#include <bits/stdc++.h>
using namespace std;
const int N = 20, M = 1e5 + 10, MX = 1 << N;
int n, m;
int dp[N + 1][MX];
char inp[M];
int a[MX];
int main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int n, m;
  scanf("%d%d", &n, &m);
  int lim = 1 << n;
  for (int i = 0; i < n; i++) {
    scanf("%s", inp);
    for (int j = 0; j < m; j++) a[j] += (inp[j] - '0') << i;
  }
  for (int i = 0; i < m; i++) dp[0][a[i]]++;
  for (int i = 0; i < n; i++)
    for (int k = n; k >= 1; k--)
      for (int j = 0; j < lim; j++) dp[k][j] += dp[k - 1][j ^ (1 << i)];
  memset(a, 0, sizeof a);
  for (int j = 0; j <= n; j++)
    for (int i = 0; i < lim; i++) a[i] += min(j, n - j) * dp[j][i];
  cout << *min_element(a, a + lim) << endl;
}
