#include <bits/stdc++.h>
using namespace std;
char a[501][501];
bool b[501][501];
int c[501][501];
int n, m, k;
int sum(int i, int j, int x, int l) {
  int s = c[x][l];
  if (i > 0) s -= c[i - 1][l];
  if (j > 0) s -= c[x][j - 1];
  if (i > 0 && j > 0) s += c[i - 1][j - 1];
  return s;
}
int main() {
  int i, j, x, y;
  scanf("%d %d %d", &n, &m, &k);
  for (i = 0; i < n; i++) {
    scanf("%s", &a[i]);
  }
  for (i = 1; i < n - 1; i++)
    for (j = 1; j < m - 1; j++) {
      if (a[i][j] == '1' && a[i + 1][j] == '1' && a[i - 1][j] == '1' &&
          a[i][j + 1] == '1' && a[i][j - 1] == '1')
        b[i][j] = 1;
    }
  c[i][j] = b[i][j];
  for (i = 1; i < n; i++) c[i][0] = b[i][0] + c[i - 1][0];
  for (j = 1; j < m; j++) c[0][j] = b[0][j] + c[0][j - 1];
  for (i = 1; i < n; i++)
    for (j = 1; j < m; j++) {
      c[i][j] = b[i][j] + c[i][j - 1] + c[i - 1][j] - c[i - 1][j - 1];
    }
  long long r = 0;
  for (i = 0; i < n; i++)
    for (j = i + 2; j < n; j++) {
      x = 0;
      y = 2;
      while (y < m) {
        int s = sum(i + 1, x + 1, j - 1, y - 1);
        if (s < k)
          y++;
        else {
          r += m - y;
          x++;
        }
      }
    }
  cout << r << endl;
  return 0;
}
