#include <bits/stdc++.h>
using namespace std;
char a[555][555];
int st[555][555];
int main(void) {
  int n, m, K;
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 0; i < n; i++) scanf("%s", a[i]);
  for (int i = 1; i < n - 1; i++)
    for (int j = 1; j < m; j++)
      if (a[i][j] == '1' && a[i - 1][j] == '1' && a[i][j - 1] == '1' &&
          a[i][j + 1] == '1' && a[i + 1][j] == '1') {
        st[i][j] = st[i][j - 1] + 1;
      } else
        st[i][j] = st[i][j - 1];
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int r[555] = {};
    for (int j = i + 2; j < n; j++) {
      for (int k = 0; k < m; k++) r[k] += st[j - 1][k];
      for (int k = 0, l = 0; k < m; k++) {
        while (l < m - 1 && r[l] - r[k] < K) ++l;
        if (r[l] - r[k] >= K) ans += m - l - 1;
      }
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
