#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W, K;
  cin >> H >> W >> K;
  vector<string> photo(H);
  for (int h = 0; h < int(H); ++h) cin >> photo[h];
  vector<vector<char> > star(H, vector<char>(W, 0));
  for (int r = 1; r < int(H - 1); ++r)
    for (int c = 1; c < int(W - 1); ++c) {
      if (photo[r][c] == '1' && photo[r - 1][c] == '1' &&
          photo[r][c - 1] == '1' && photo[r + 1][c] == '1' &&
          photo[r][c + 1] == '1') {
        star[r][c] = 1;
      }
    }
  long long res = 0;
  for (int c1 = 0; c1 < int(W); ++c1) {
    vector<int> row_stars(H, 0);
    for (int c2 = c1 + 3; c2 <= int(W); ++c2) {
      for (int r = 0; r < int(H); ++r) row_stars[r] += star[r][c2 - 2];
      int r1 = 0, stars = 0;
      for (int r2 = r1 + 3; r2 <= int(H); ++r2) {
        stars += row_stars[r2 - 2];
        while (stars - row_stars[r1 + 1] >= K) {
          stars -= row_stars[r1 + 1];
          ++r1;
        }
        if (stars >= K) res += r1 + 1;
      }
    }
  }
  cout << res << endl;
}
