#include <bits/stdc++.h>
using namespace std;
char s[512][512];
bool h[512][512];
int H[512][512], U[512];
int n, m, T;
int main() {
  int i, j, k, x, l, r, md;
  scanf("%d%d%d", &n, &m, &T);
  gets(s[0]);
  for (i = 1; i <= (n); ++i) gets(s[i] + 1);
  for (i = 1; i <= (n); ++i)
    for (j = 1; j <= (m); ++j)
      h[i][j] =
          ((s[i][j] == '1') && (s[i - 1][j] == '1') && (s[i][j - 1] == '1') &&
           (s[i + 1][j] == '1') && (s[i][j + 1] == '1'));
  for (j = 1; j <= (m); ++j) {
    H[0][j] = 0;
    for (i = 1; i <= (n); ++i) H[i][j] = H[i - 1][j] + h[i][j];
  }
  long long ans = 0;
  for (i = 1; i <= (n); ++i)
    for (j = i + 1; j < n; ++j) {
      U[0] = 0;
      for (k = 1; k <= (m); ++k) U[k] = U[k - 1] + H[j][k] - H[i][k];
      for (x = 1; x <= (m); ++x)
        if (U[m - 1] - U[x] >= T) {
          for (l = x, r = m - 1; l + 1 < r;) {
            md = (l + r) >> 1;
            if (U[md] - U[x] >= T)
              r = md;
            else
              l = md;
          }
          ans += m - r;
        }
    }
  cout << ans << endl;
  return 0;
}
