#include <bits/stdc++.h>
using namespace std;
int s;
char mp[22][200005];
long long a[2000036], b[2000036];
void FWT(long long *A) {
  for (int len = 2; len <= s; len <<= 1) {
    int g = len >> 1;
    for (int i = 0; i < s; i += len) {
      for (int j = 0; j < g; j++) {
        long long a = A[i + j], b = A[i + j + g];
        A[i + j] = (a + b);
        A[i + j + g] = (a - b);
      }
    }
  }
}
void IFWT(long long *A) {
  for (int len = s; len >= 2; len >>= 1) {
    int g = len >> 1;
    for (int i = 0; i < s; i += len) {
      for (int j = 0; j < g; j++) {
        long long a = A[i + j], b = A[i + j + g];
        A[i + j] = (a + b) / 2;
        A[i + j + g] = (a - b) / 2;
      }
    }
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", mp[i]);
  for (int i = 0; i < m; i++) {
    int t = 0;
    for (int j = 0; j < n; j++)
      if (mp[j][i] == '1') t += (1 << j);
    a[t]++;
  }
  for (int i = 0; i < (1 << n); i++) {
    int cnt1 = 0;
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) cnt1++;
    }
    b[i] = min(cnt1, n - cnt1);
  }
  s = (1 << n);
  FWT(a);
  FWT(b);
  for (int i = 0; i < s; i++) a[i] = a[i] * b[i];
  IFWT(a);
  long long ans = 0x3f3f3f3f;
  for (int i = 0; i < s; i++) ans = min(ans, a[i]);
  cout << ans << endl;
  return 0;
}
