#include <bits/stdc++.h>
using namespace std;
void fast_in() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  fast_in();
  int n, m, k;
  cin >> n >> m >> k;
  vector<string> s(n);
  for (int i = 0; i < n; i++) cin >> s[i];
  vector<vector<vector<int>>> dp(
      m + 1, vector<vector<int>>(k + 1, vector<int>(3, 1e9)));
  dp[m][0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int i = 0; i <= k; i++) {
      dp[0][i][0] = min({dp[m][i][0], dp[m][i][1], dp[m][i][2]});
    }
    for (int i = 1; i <= m; i++)
      for (int x = 0; x <= k; x++)
        for (int j = 0; j < 3; j++) dp[i][x][j] = 1e9;
    for (int j = 1; j <= m; j++) {
      for (int l = 0; l <= k; l++) {
        if (l > 0 || s[i - 1][j - 1] == '0') {
          int c1 = min(dp[j - 1][l - (s[i - 1][j - 1] == '1')][2],
                       dp[j - 1][l - (s[i - 1][j - 1] == '1')][1]);
          dp[j][l][2] = c1;
          dp[j][l][0] = dp[j - 1][l - (s[i - 1][j - 1] == '1')][0];
        }
        dp[j][l][1] = min(dp[j - 1][l][1] + 1, dp[j - 1][l][0] + 1);
      }
    }
  }
  int res = 1e9;
  for (auto i : dp[m]) {
    for (auto t : i) {
      res = min(res, t);
    }
  }
  cout << res;
  return 0;
}
