#include <bits/stdc++.h>
using namespace std;
char s[25][100010];
int cnt[1048576], cost[1048576];
void FWT(int *a, int n) {
  int N = 1 << n;
  int i, j, k;
  int tmp0, tmp1;
  for (i = 1; i < N; i <<= 1) {
    for (j = 0; j < N; j += i << 1) {
      for (k = 0; k < i; ++k) {
        tmp0 = a[j + k], tmp1 = a[i + j + k];
        a[j + k] = tmp0 - tmp1;
        a[i + j + k] = tmp0 + tmp1;
      }
    }
  }
}
void IFWT(long long *a, int n) {
  int N = 1 << n;
  int i, j, k;
  long long tmp0, tmp1;
  for (i = 1; i < N; i <<= 1) {
    for (j = 0; j < N; j += i << 1) {
      for (k = 0; k < i; ++k) {
        tmp0 = a[j + k];
        tmp1 = a[i + j + k];
        a[j + k] = tmp0 + tmp1 >> 1;
        a[i + j + k] = tmp1 - tmp0 >> 1;
      }
    }
  }
}
long long ans[1048576];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int i;
  for (i = 0; i < n; ++i) cin >> s[i];
  int j;
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) s[i][j] ^= 48;
    char flag = s[i][0];
    for (j = 0; j < m; ++j) s[i][j] ^= flag;
  }
  for (i = 0; i < m; ++i) {
    int sum = 0;
    for (j = 0; j < n; ++j) sum |= s[j][i] << j;
    ++cnt[sum];
  }
  for (i = 0; i < 1 << n; ++i) {
    cost[i] = min(__builtin_popcount(i), __builtin_popcount(i ^ (1 << n) - 1));
  }
  FWT(cnt, n);
  FWT(cost, n);
  for (i = 0; i < 1 << n; ++i) ans[i] = (long long)cnt[i] * cost[i];
  IFWT(ans, n);
  long long min_ = 1e18;
  for (i = 0; i < 1 << n; ++i) min_ = min(min_, ans[i]);
  cout << min_ << '\n';
  return 0;
}
