#include <bits/stdc++.h>
using namespace std;
int a[505][505];
char c[505][505];
int dp[505][505];
int main() {
  int n, m, k;
  char x;
  long long int ans = 0;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> c[i][j];
      a[i][j] = c[i][j] - '0';
    }
  for (int i = 2; i <= n - 1; i++)
    for (int j = 2; j <= m - 1; j++)
      dp[i][j] =
          a[i][j] && a[i + 1][j] && a[i][j + 1] && a[i - 1][j] && a[i][j - 1];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) dp[i][j] += dp[i - 1][j];
  for (int i = 1; i <= n - 1; i++)
    for (int j = i + 1; j <= n; j++) {
      int curr = 0, right = 1;
      for (int z = 2; z <= m - 1; z++) {
        while (curr < k) {
          right++;
          if (right >= m) break;
          curr += -dp[i][right] + dp[j - 1][right];
        }
        if (right >= m) break;
        ans += m - right;
        curr -= -dp[i][z] + dp[j - 1][z];
      }
    }
  cout << ans << endl;
  return 0;
}
