#include <bits/stdc++.h>
using namespace std;
const int maxr = 20;
string s[maxr];
int F[maxr + 1][1 << maxr];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int col = 0; col < m; col++) {
    int perCol = 0;
    for (int row = 0; row < n; row++) {
      if (s[row][col] == '1') perCol |= (1 << row);
    }
    F[0][perCol]++;
  }
  for (int i = 0; i < n; i++) {
    for (int dif = i + 1; dif >= 1; dif--) {
      for (int mask = 0; mask < (1 << n); mask++) {
        F[dif][mask] += F[dif - 1][mask ^ (1 << i)];
      }
    }
  }
  int ret = INT_MAX;
  for (int mask = 0; mask < (1 << n); mask++) {
    int ans = 0;
    for (int dif = 0; dif <= n; dif++) ans += min(dif, n - dif) * F[dif][mask];
    ret = min(ret, ans);
  }
  printf("%d", ret);
}
