#include <bits/stdc++.h>
using namespace std;
const int dx[5] = {0, 0, 0, -1, 1};
const int dy[5] = {0, -1, 1, 0, 0};
const int maxn = 510;
char c[maxn][maxn];
int r[maxn][maxn];
int a[maxn][maxn];
int s[maxn][maxn];
inline int Get(int djigd, int gjigu, int y2, int x2) {
  --djigd;
  --gjigu;
  return s[y2][x2] - s[y2][gjigu] - s[djigd][x2] + s[djigd][gjigu];
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      cin >> c[i][j];
      r[i][j] = c[i][j] - '0';
    }
  for (int i = 1; i + 1 < n; ++i) {
    for (int j = 1; j + 1 < m; ++j) {
      bool flag = true;
      for (int k = 0; k < 5; ++k)
        if (r[i + dy[k]][j + dx[k]] != 1) flag = false;
      a[i][j] = flag;
      s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + a[i][j];
    }
  }
  long long ans = 0;
  for (int i = 0; i < m; ++i)
    for (int j = i + 2; j < m; ++j) {
      int r = 2;
      for (int l = 0; l < n; ++l) {
        while (r < n && Get(l + 1, i + 1, r - 1, j - 1) < k) ++r;
        if (r >= n) break;
        ans += n - r;
      }
    }
  cout << ans << endl;
  return 0;
}
