#include <bits/stdc++.h>
int N, M, K, dp[501][501], temp;
long long ans = 0;
char str[501][501];
int findarea(int x1, int y1, int x2, int y2) {
  return dp[x2][y2] + dp[x1 - 1][y1 - 1] - dp[x1 - 1][y2] - dp[x2][y1 - 1];
}
int main() {
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 0; i < N; i++) scanf("%s", str[i]);
  for (int i = 1; i < N - 1; i++)
    for (int j = 1; j < M - 1; j++)
      if (str[i][j] == '1' && str[i - 1][j] == '1' && str[i][j - 1] == '1' &&
          str[i + 1][j] == '1' && str[i][j + 1] == '1')
        dp[i][j]++;
  for (int i = 1; i < M; i++) dp[0][i] += dp[0][i - 1];
  for (int i = 1; i < N; i++) dp[i][0] += dp[i - 1][0];
  for (int i = 1; i < N; i++)
    for (int j = 1; j < M; j++)
      dp[i][j] += dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
  for (int i = 2; i < N; i++)
    for (int j = 2; j < M; j++) {
      int run = 0;
      for (int k = j - 2; k >= 0; k--) {
        temp = findarea(run + 1, k + 1, i - 1, j - 1);
        while (run < i - 2 && findarea(run + 2, k + 1, i - 1, j - 1) >= K) {
          run++;
          temp = findarea(run + 1, k + 1, i - 1, j - 1);
        }
        if (temp >= K) {
          ans += (long long)(run + 1);
        }
      }
    }
  printf("%I64d\n", ans);
  return 0;
}
