#include <bits/stdc++.h>
using namespace std;
char A[510][510];
const int di[] = {0, 0, 1, 0, -1};
const int dj[] = {0, 1, 0, -1, 0};
bool check(int i, int j) {
  for (int k = 0; k < 5; k++) {
    int i1 = i + di[k];
    int j1 = j + dj[k];
    if (A[i1][j1] != '1') return (false);
  }
  return (true);
}
int tab[510][510];
inline int f(int i, int j1, int j2) { return (tab[i][j2] - tab[i][j1 - 1]); }
int main() {
  int n, m, k;
  scanf("%d %d %d\n", &n, &m, &k);
  memset(A, '0', sizeof(A));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) scanf("%c", &A[i][j]);
    scanf("\n");
  }
  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int j = 1; j <= m; j++) {
      if (check(i, j)) cnt++;
      tab[i][j] = cnt;
    }
  }
  unsigned long long res = 0;
  for (int l = 2; l <= m - 1; l++)
    for (int r = l; r <= m - 1; r++)
      for (int t = 2, b = 2, cnt = f(t, l, r); b <= n - 1;) {
        if (cnt >= k) {
          res += n - b;
          cnt -= f(t++, l, r);
          continue;
        }
        cnt += f(++b, l, r);
      }
  printf("%I64d", res);
exit:
  return (0);
}
