#include <bits/stdc++.h>
using namespace std;
const int N = 505;
bool arr[N][N];
int dp[N][N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    for (int j = 1; j <= m; j++) {
      arr[i][j] = (int)(s[j - 1] - '0');
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (arr[i][j] && arr[i - 1][j] && arr[i + 1][j] && arr[i][j - 1] &&
          arr[i][j + 1]) {
        dp[i][j] = 1;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      dp[i][j] += dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
    }
  }
  long long int ans = 0;
  for (int a = 2; a < n; a++) {
    for (int b = a; b < n; b++) {
      int ptr = 1;
      for (int c = 2; c < m; c++) {
        while (ptr < m &&
               (dp[a - 1][c - 1] - dp[b][c - 1] - dp[a - 1][ptr] + dp[b][ptr] <
                k)) {
          ptr++;
        }
        ans += (m - ptr);
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
