#include <bits/stdc++.h>
using namespace std;
inline int L(int i) { return i << 1; }
inline int R(int i) { return (i << 1) | 1; }
inline int B(int i) { return 1 << i; }
inline int low_bit(int x) { return x & (-x); }
int mat[510][510], dp[510];
char s[510][510];
int ok(int i, int j) {
  if (s[i][j] == '1' && s[i + 1][j] == '1' && s[i][j + 1] == '1' &&
      s[i][j - 1] == '1' && s[i - 1][j] == '1')
    return 1;
  return 0;
}
int main() {
  int n, m, k;
  long long ret = 0;
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    memset(mat, 0, sizeof(mat));
    for (int i = 0; i < n; i++) scanf("%s", s[i]);
    for (int i = 1; i < n - 1; i++)
      for (int j = 1; j < m - 1; j++) {
        mat[i][j] = mat[i][j - 1];
        if (ok(i, j)) mat[i][j] += 1;
      }
    ret = 0;
    for (int i = 0; i < m; i++)
      for (int j = i + 2; j < m; j++) {
        for (int u = 0; u < n; u++) dp[u] = mat[u][j - 1] - mat[u][i];
        int u = 0, v = u + 2, cnt = dp[v - 1];
        for (; u < n && v < n; u++) {
          cnt -= dp[u];
          for (; cnt < k && v < n; v++) cnt += dp[v];
          ret += n - v;
        }
      }
    cout << ret << endl;
  }
  return 0;
}
