#include <bits/stdc++.h>
using namespace std;
int xx[] = {0, 1, -1, 0, 0};
int yy[] = {0, 0, 0, 1, -1};
int A[566][566], sp[566][566], V[566];
int main() {
  int n, m, k, i, j, t;
  cin >> n >> m >> k;
  cin.get();
  for (i = 1; i <= n; ++i) {
    string str;
    cin >> str;
    for (j = 0; j < m; ++j) A[i][j + 1] = str[j] - '0';
  }
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) {
      bool okz = false;
      for (t = 0; t < 5; ++t)
        if (A[i + xx[t]][j + yy[t]] == 0) okz = true;
      if (okz == false) ++sp[i][j];
    }
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) sp[i][j] += sp[i - 1][j];
  long long result = 0;
  for (i = 1; i <= n; ++i)
    for (j = i + 1; j <= n; ++j) {
      for (t = 1; t <= m; ++t) V[t] = sp[j - 1][t] - sp[i][t];
      int suma = 0;
      int ind = 1;
      for (t = 1; t <= m; ++t) {
        suma += V[t - 1];
        if (suma < k) continue;
        while (suma - V[ind + 1] >= k) {
          suma -= V[ind + 1];
          ++ind;
        }
        result += (long long)ind;
      }
    }
  cout << result << '\n';
  return 0;
}
