#include <bits/stdc++.h>
using namespace std;
int n, m, g;
char s[505][505];
int a[505][505], b[505];
bool ch(int x, int y) {
  if (s[x][y] != '1') return 0;
  for (int dx = -1; dx <= 1; ++dx)
    for (int dy = -1; dy <= 1; ++dy)
      if (1 == abs(dx) + abs(dy))
        if (s[x + dx][y + dy] != '1') return 0;
  return 1;
}
int main() {
  scanf("%d %d %d", &n, &m, &g);
  if (n <= 2 || m <= 2) {
    puts("0");
    return 0;
  }
  for (int i = 0; i < n; ++i) scanf("%s", s[i]);
  for (int i = 1; i < n - 1; ++i)
    for (int j = 1; j < m - 1; ++j) a[i][j] = ch(i, j);
  for (int i = 1; i < n; ++i)
    for (int j = 1; j < m; ++j) a[i][j] += a[i][j - 1];
  for (int j = 1; j < m; ++j)
    for (int i = 1; i < n; ++i) a[i][j] += a[i - 1][j];
  long long ans = 0;
  for (int p = 1; p < n - 1; ++p)
    for (int q = p; q < n - 1; ++q) {
      for (int j = 0; j < m; ++j) b[j] = a[q][j] - a[p - 1][j];
      int k = 0;
      for (int j = 1; j < m - 1; ++j) {
        while (k < m - 1 && b[k] - b[j - 1] < g) ++k;
        if (k < m - 1 && b[k] - b[j - 1] >= g) ans += m - 1 - k;
      }
    }
  cout << ans << endl;
  return 0;
}
