#include <bits/stdc++.h>
using namespace std;
const int N = 550;
int n, m, k, ps[N][N];
long long ans;
char c[N][N];
bool star(int x, int y) {
  return c[x][y] == '1' && c[x + 1][y] == '1' && c[x - 1][y] == '1' &&
         c[x][y - 1] == '1' && c[x][y + 1] == '1';
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> c[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) ps[i][j] = ps[i][j - 1] + star(i, j);
  for (int i = 1; i <= m; i++)
    for (int j = i + 2; j <= m; j++) {
      int p = 2, sum = 0;
      for (int x = 1; x <= n; x++) {
        while (sum < k && p <= n) {
          sum += ps[p][j - 1] - ps[p][i];
          p++;
        }
        if (sum < k) break;
        ans += n - p + 1;
        sum -= ps[x + 1][j - 1] - ps[x + 1][i];
      }
    }
  cout << ans;
  return 0;
}
