#include <bits/stdc++.h>
const long long N = 21;
const long long M = 1e5 + 100;
long long n, m;
long long value[M];
void init() {
  std::cin >> n >> m;
  std::memset(value, 0, sizeof(value));
  for (long long i = 0; i < n; i++) {
    std::string str;
    std::cin >> str;
    for (long long j = 0; j < (long long)str.length(); j++) {
      if (str[j] == '1') {
        value[j] += 1 << i;
      }
    }
  }
}
void fwt(long long a[], long long length, long long dir) {
  if (length == 1) {
    return;
  }
  long long half = length >> 1;
  fwt(a, half, dir);
  fwt(a + half, half, dir);
  for (long long i = 0; i < half; i++) {
    long long t0 = a[i], t1 = a[i + half];
    if (dir == 1) {
      a[i] = t0 + t1;
      a[i + half] = t0 - t1;
    } else {
      a[i] = (t0 + t1) / 2;
      a[i + half] = (t0 - t1) / 2;
    }
  }
}
void work() {
  static long long a[1 << N], b[1 << N];
  std::memset(a, 0, sizeof(a));
  std::memset(b, 0, sizeof(b));
  for (long long i = 0; i < m; i++) {
    a[value[i]]++;
  }
  for (long long state = 0; state < (1 << n); state++) {
    long long t = __builtin_popcount(state);
    b[state] = std::min(t, n - t);
  }
  static long long answer[1 << N];
  fwt(a, 1 << n, 1);
  fwt(b, 1 << n, 1);
  for (long long state = 0; state < (1 << n); state++) {
    answer[state] = a[state] * b[state];
  }
  fwt(answer, 1 << n, -1);
  std::cout << *std::min_element(answer, answer + (1 << n)) << std::endl;
}
int main() {
  init();
  work();
  return 0;
}
