#include <bits/stdc++.h>
using namespace std;
int N, M, K, dp[505][505];
char g[505][505];
bool check(int r, int c) {
  int dx[] = {-1, 1, 0, 0};
  int dy[] = {0, 0, -1, 1};
  if (r < 0 || c < 0) return false;
  if (g[r][c] == '0') return false;
  for (int i = 0; i < 4; ++i) {
    int nextR = r + dx[i];
    int nextC = c + dy[i];
    if (nextR < 0 || nextC < 0) return false;
    if (g[nextR][nextC] == '0') return false;
  }
  return true;
}
int cntStars(int r1, int c1, int r2, int c2) {
  return dp[r2][c2] - dp[r1 + 1][c2] - dp[r2][c1 + 1] + dp[r1 + 1][c1 + 1];
}
int main() {
  scanf("%d %d %d", &N, &M, &K);
  for (int i = 0; i < N; ++i) scanf("%s", &g[i]);
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      dp[i + 1][j + 1] =
          dp[i][j + 1] + dp[i + 1][j] - dp[i][j] + check(i - 1, j - 1);
    }
  }
  long long res = 0;
  for (int r2 = 3; r2 <= N; ++r2) {
    for (int c2 = 3; c2 <= M; ++c2) {
      int c1 = c2 - 2;
      for (int r1 = 1; r1 < r2 - 1; ++r1) {
        while (c1 >= 1 && cntStars(r1, c1, r2, c2) < K) --c1;
        if (c1 >= 1 && cntStars(r1, c1, r2, c2) >= K) res += c1;
      }
    }
  }
  cout << res << endl;
  return 0;
}
