#include <bits/stdc++.h>
using namespace std;
const int MX = 509;
string str[MX];
int n, m, arr[MX][MX], K;
long long ans = 0;
void calc(vector<int> &v) {
  int cur = v[2];
  int it1 = 1, it2 = 3;
  while (it2 <= m) {
    if (cur < K) {
      cur += v[it2++];
      continue;
    } else {
      ans += m - it2 + 1;
      cur -= v[++it1];
      continue;
    }
  }
}
int main() {
  cin >> n >> m >> K;
  if (min(n, m) < 3) {
    puts("0");
    return 0;
  }
  for (int j = 0; j <= m + 1; j++) str[0].push_back('#');
  for (int j = 1; j <= n; j++) {
    cin >> str[j];
    str[j] = "#" + str[j] + "#";
  }
  for (int j = 1; j <= n; j++) {
    for (int i = 1; i <= m; i++) {
      if (str[j][i] != '1') continue;
      if (str[j - 1][i] != '1') continue;
      if (str[j + 1][i] != '1') continue;
      if (str[j][i + 1] != '1') continue;
      if (str[j][i - 1] != '1') continue;
      arr[j][i] = 1;
    }
  }
  for (int x1 = 1; x1 <= n; x1++) {
    vector<int> v(m + 1, 0);
    for (int x2 = x1 + 2; x2 <= n; x2++) {
      for (int j = 1; j <= m; j++) v[j] += arr[x2 - 1][j];
      calc(v);
    }
  }
  cout << ans << endl;
}
