#include <bits/stdc++.h>
using namespace std;
int n, m, p;
char arr[504][504];
int grid[504][504];
int dr[] = {1, -1, 0, 0};
int dc[] = {0, 0, 1, -1};
int getsum(int r1, int c1, int r2, int c2) {
  return grid[r2][c2] - grid[r1 - 1][c2] - grid[r2][c1 - 1] +
         grid[r1 - 1][c1 - 1];
}
int main() {
  scanf("%d%d%d", &n, &m, &p);
  if (n < 3 || m < 3) {
    printf("0\n");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    getchar();
    for (int j = 0; j < m; j++) scanf("%c", &arr[i][j]);
  }
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++)
      for (int k = 0; k < 4 && arr[i][j] == '1'; k++)
        if (!(arr[i + dr[k]][j + dc[k]] == '1'))
          break;
        else if (k == 3)
          grid[i][j] = 1;
  }
  for (int i = 1; i < n - 1; i++)
    for (int j = 1; j < m - 1; j++) {
      grid[i][j] += grid[i - 1][j] + grid[i][j - 1] - grid[i - 1][j - 1];
    }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 2; j < n; j++) {
      int start = 0, End = start + 2;
      while (End - start >= 2 && End < m) {
        int cur = getsum(i + 1, start + 1, j - 1, End - 1);
        if (cur >= p) {
          ans += (long long)(m - End);
          start++;
          End = max(End, start + 2);
        } else
          End++;
      }
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
