#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-10;
template <typename T, typename S>
vector<T>& operator<<(vector<T>& a, S b) {
  a.push_back(b);
  return a;
}
template <typename T>
void operator>>(vector<T>& a, int b) {
  while (b--)
    if (!a.empty()) a.pop_back();
}
bool isprime(int n) {
  if (n < 2) return false;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
long long b_pow(long long x, long long n) {
  return n ? b_pow(x * x, n / 2) * (n % 2 ? x : 1) : 1ll;
}
string itos(int n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
char star[501][501];
int dp[501][501] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  int W, H, K;
  cin >> H >> W >> K;
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      cin >> star[i][j];
    }
  }
  for (int i = 1; i + 2 <= H; i++) {
    for (int j = 1; j + 2 <= W; j++) {
      if (star[i + 1][j] == '1' && star[i + 1][j + 1] == '1' &&
          star[i + 1][j + 2] == '1' && star[i][j + 1] == '1' &&
          star[i + 2][j + 1] == '1')
        dp[i][j] = 1;
    }
  }
  for (int i = 1; i <= H; i++)
    for (int j = 1; j <= W; j++) dp[i][j] += dp[i][j - 1];
  for (int i = 1; i <= H; i++)
    for (int j = 1; j <= W; j++) dp[i][j] += dp[i - 1][j];
  long long ans = 0;
  for (int y1 = 1; y1 <= H - 2; y1++) {
    for (int y2 = y1; y2 <= H - 2; y2++) {
      int L = 1, R = 1;
      while (R <= W - 2) {
        int current =
            dp[y2][R] - dp[y1 - 1][R] - dp[y2][L - 1] + dp[y1 - 1][L - 1];
        if (current >= K) {
          ans += W - 2 - R + 1;
          L++;
          R = max(L, R);
        } else {
          R++;
        }
      }
    }
  }
  cout << ans << endl;
}
