#include <bits/stdc++.h>
using namespace std;
long long int cnt;
int sum[510][510], N, M, K;
int s[510][510];
int main() {
  cin >> N >> M >> K;
  char a;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++) {
      scanf(" %c", &a);
      s[i][j] = a - '0';
    }
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++)
      if (s[i][j] && s[i - 1][j] && s[i][j + 1] && s[i + 1][j] && s[i][j - 1])
        sum[i][j] = 1;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++)
      sum[i][j] += sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1];
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++) {
      int 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++)
          ;
        cnt += tmp - 1;
      }
    }
  cout << cnt << endl;
  return 0;
}
