#include <bits/stdc++.h>
using namespace std;
int n, m, K;
char mp[510][510];
int dp[510][510];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int main() {
  setbuf(stdout, NULL);
  int i, j, k;
  scanf("%d%d%d", &n, &m, &K);
  for (i = 1; i <= n; i++) {
    scanf("%s", mp[i] + 1);
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
      if (mp[i][j] == '1') {
        for (k = 0; k < 4; k++) {
          if (mp[i + dx[k]][j + dy[k]] != '1') break;
        }
        if (k >= 4) dp[i][j]++;
      }
    }
  }
  int ii, jj;
  long long ans = 0;
  for (i = 1; i <= n; i++) {
    for (ii = i + 1; ii < n; ii++) {
      jj = 2;
      for (j = 1; j <= m; j++) {
        int sum = dp[ii][jj] - dp[i][jj] - dp[ii][j] + dp[i][j];
        while (jj <= m && sum < K) {
          jj++;
          sum = dp[ii][jj] - dp[i][jj] - dp[ii][j] + dp[i][j];
        }
        if (sum >= K)
          ans += (m - jj);
        else
          break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
