#include <bits/stdc++.h>
using namespace std;
int fld0[510][510];
int fld1[510][510];
int sumv[510][510];
int main() {
  int H, W, K;
  while (3 == scanf("%d%d%d", &H, &W, &K)) {
    for (int y = 0; y < (int)(H); y++)
      for (int x = 0; x < (int)(W); x++) {
        char c;
        scanf(" %c", &c);
        fld0[y][x] = c - '0';
      }
    for (int y = 1; y < H; ++y) {
      for (int x = 1; x < W; ++x) {
        int s = 0;
        for (int dx = -1; dx <= 1; ++dx) {
          for (int dy = -1; dy <= 1; ++dy) {
            if (abs(dx) + abs(dy) <= 1) {
              s += fld0[y + dy][x + dx];
            }
          }
        }
        fld1[y - 1][x - 1] = s == 5 ? 1 : 0;
      }
    }
    H -= 2;
    W -= 2;
    for (int x = 0; x < (int)(W); x++) {
      sumv[0][x] = 0;
      for (int y = 0; y < (int)(H); y++)
        sumv[y + 1][x] = sumv[y][x] + fld1[y][x];
    }
    long long ans = 0;
    for (int ylb = 0; ylb < H; ++ylb) {
      for (int yub = ylb + 1; yub <= H; ++yub) {
        int xub = 0, s = 0;
        for (int xlb = 0; xlb < W; ++xlb) {
          while (xub < W && s < K) {
            s += sumv[yub][xub] - sumv[ylb][xub];
            ++xub;
          }
          if (s >= K) ans += W - xub + 1;
          s -= sumv[yub][xlb] - sumv[ylb][xlb];
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
