#include <bits/stdc++.h>
int n, m, K;
char buf[500][501];
int a[500][500];
int s[501][501];
int main() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 0; i < n; ++i) {
    scanf("%s", buf[i]);
  }
  memset(a, 0, sizeof(a));
  for (int i = 1; i + 1 < n; ++i) {
    for (int j = 1; j + 1 < m; ++j) {
      if (buf[i][j] == '1' && buf[i - 1][j] == '1' && buf[i + 1][j] == '1' &&
          buf[i][j - 1] == '1' && buf[i][j + 1] == '1') {
        a[i][j] = 1;
      }
    }
  }
  for (int i = 0; i < m; ++i) {
    for (int j = 1; j + 1 < n; ++j) {
      s[j][i] = s[j - 1][i] + a[j][i];
    }
  }
  long long res = 0;
  for (int i = 1; i < n; ++i) {
    for (int j = i; j + 1 < n; ++j) {
      int count[501], p = 0;
      memset(count, 0, sizeof(int) * m);
      for (int k = 1; k + 1 < m; ++k) {
        int t = count[k] = count[k - 1] + s[j][k] - s[i - 1][k];
        for (; t - count[p] >= K; ++p)
          ;
        res += p;
      }
    }
  }
  printf("%I64d\n", res);
  return 0;
}
