#include <bits/stdc++.h>
using namespace std;
int N, M, K;
int ar[510][510];
int stars[510][510];
int sum[510][510];
int sum1[510][510];
long long res;
int main() {
  scanf("%d%d%d", &N, &M, &K);
  char ch;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++) {
      scanf(" %c", &ch);
      ar[i][j] = ch - '0';
    }
  for (int i = 2; i < N; i++)
    for (int j = 2; j < M; j++)
      if (ar[i - 1][j] && ar[i + 1][j] && ar[i][j - 1] && ar[i][j + 1] &&
          ar[i][j])
        stars[i][j] = 1;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++)
      sum[i][j] =
          stars[i][j] + sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
  int tmp;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++) {
      tmp = 1;
      for (int k = j - 2; k >= 1; k--) {
        for (; tmp < i - 1 && sum[i - 1][j - 1] - sum[tmp][j - 1] -
                                      sum[i - 1][k] + sum[tmp][k] >=
                                  K;
             tmp++)
          ;
        res += (long long)tmp - 1;
      }
    }
  cout << res << endl;
  return 0;
}
