#include <bits/stdc++.h>
using namespace std;
int n, m, k;
char a[555][555];
int ok[555][555];
int ps[555][555];
int main() {
  gets(a[0]);
  sscanf(a[0], "%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; ++i) {
    gets(a[i]);
  }
  for (int i = 1; i < n - 1; ++i) {
    ps[i][0] = 0;
    for (int j = 1; j < m - 1; ++j) {
      if (a[i][j] == '1' && a[i - 1][j] == '1' && a[i + 1][j] == '1' &&
          a[i][j - 1] == '1' && a[i][j + 1] == '1') {
        ok[i][j] = 1;
      }
      ps[i][j] = ps[i][j - 1] + ok[i][j];
    }
    ps[i][m - 1] = ps[i][m - 2];
  }
  long long ans = 0;
  for (int st = 0; st < m; ++st) {
    for (int fn = st + 2; fn < m; ++fn) {
      int end = 1, tot = 0;
      for (int beg = 0; beg < n - 1; ++beg) {
        while (end < n && tot < k) {
          tot += (ps[end][fn - 1] - ps[end][st]);
          ++end;
        }
        if (tot >= k) {
          ans += (n - end);
        }
        tot -= (ps[beg + 1][fn - 1] - ps[beg + 1][st]);
      }
    }
  }
  cout << ans << endl;
}
