#include <bits/stdc++.h>
using namespace std;
string arr[21];
long long dp[21][(1 << 20)];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < m; i++) {
    int num = 0;
    for (int j = 0; j < n; j++) {
      num += (arr[j][i] - '0') * (1 << j);
    }
    dp[0][num]++;
  }
  for (int k = 1; k < n; k++) {
    for (int j = 0; j < (1 << n); j++) {
      for (int m = 0; m < n; m++) {
        dp[k][j] += dp[k - 1][j ^ (1 << m)];
      }
      if (k > 1) dp[k][j] += (k - 2 - n) * dp[k - 2][j];
      dp[k][j] /= k;
    }
  }
  long long res = n * m;
  for (int i = 0; i < (1 << n); i++) {
    long long can = 0;
    for (int j = 0; j <= n; j++) {
      can += min(j, n - j) * dp[j][i];
    }
    res = min(res, can);
  }
  cout << res;
  return 0;
}
