#include <bits/stdc++.h>
using namespace std;
const int maxn = 500 + 10;
char s[maxn][maxn];
int dp[maxn][maxn];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  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) {
      if (s[i][j] == '1' && s[i - 1][j] == '1' && s[i + 1][j] == '1' &&
          s[i][j - 1] == '1' && s[i][j + 1] == '1')
        dp[i][j] = dp[i][j - 1] + 1;
      else
        dp[i][j] = dp[i][j - 1];
    }
  }
  long long ans = 0ll;
  for (int a = 0; a < m - 2; ++a) {
    for (int b = a + 2; b < m; ++b) {
      long long t = dp[1][b - 1] - dp[1][a];
      int j = 2;
      for (int i = 0; i < n - 2 && j < n; ++i) {
        while (j < n && (i > j - 2 || t < k)) t += dp[j][b - 1] - dp[j][a], ++j;
        ans += n - j;
        t -= dp[i + 1][b - 1] - dp[i + 1][a];
      }
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
