#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int mod = 1000000007;
const int inf = 2012345678;
const long long infl = 9012345678901234567;
const double pi = 3.1415926535897932384626433832795;
const int N = 20;
const int M = 100010;
char buf[M];
int a[M];
int dp[1 << N][N + 1];
int main() {
  freopen("input.txt", "r", stdin);
  int n, m;
  scanf("%d%d", &(n), &(m));
  for (int i = 0; i < (n); i++) {
    scanf("%s", buf);
    for (int j = 0; j < (m); j++) a[j] = 2 * a[j] + buf[j] - '0';
  }
  for (int i = 0; i < (m); i++) dp[a[i]][0]++;
  for (int i = 0; i < (m); i++)
    for (int j = 0; j < (n); j++) dp[a[i] ^ (1 << j)][1]++;
  for (int k = 2; k <= n; k++) {
    for (int i = 0; i < ((1 << n)); i++) {
      int sum = 0;
      for (int j = 0; j < (n); j++) {
        sum += dp[i ^ (1 << j)][k - 1];
      }
      sum -= (n - k + 2) * dp[i][k - 2];
      dp[i][k] = sum / k;
    }
  }
  int ans = inf;
  for (int i = 0; i < ((1 << n)); i++) {
    int s = 0;
    for (int k = 0; k <= (n); k++) {
      s += min(k, n - k) * dp[i][k];
    }
    ans = min(ans, s);
  }
  printf("%d\n", ans);
  return 0;
}
