#include <bits/stdc++.h>
int main() {
  static char cc[500][500 + 1];
  static int aa[500][500], bb[500];
  int n, m, k, i, j, l, r;
  long long ans;
  scanf("%d%d%d", &n, &m, &k);
  if (n == 1 || m == 1) {
    printf("0\n");
    return 0;
  }
  for (i = 0; i < n; i++) scanf("%s", cc[i]);
  n -= 2;
  m -= 2;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++)
      aa[i][j] = cc[i + 1][j + 1] == '1' && cc[i][j + 1] == '1' &&
                 cc[i + 2][j + 1] == '1' && cc[i + 1][j] == '1' &&
                 cc[i + 1][j + 2] == '1';
    for (j = 1; j < m; j++) aa[i][j] += aa[i][j - 1];
  }
  ans = 0;
  for (l = 0; l < m; l++)
    for (r = l; r < m; r++) {
      int cnt;
      for (i = 0; i < n; i++) bb[i] = aa[i][r] - (l == 0 ? 0 : aa[i][l - 1]);
      cnt = 0;
      for (i = 0, j = 0; i < n; i++) {
        while (j < n && cnt + bb[j] < k) cnt += bb[j++];
        ans += n - j;
        cnt -= bb[i];
      }
    }
  printf("%lld\n", ans);
  return 0;
}
