#include <bits/stdc++.h>
using namespace std;
const int maxN = 1 << 9;
int A[maxN][maxN];
int B[maxN][maxN];
int get(int i, int j, int l, int r) {
  i--, l--;
  int ans = A[j][r] - A[i][r] - A[j][l] + A[i][l];
  return ans;
}
int c[3][3] = {{0, 1, 0}, {1, 1, 1}, {0, 1, 0}};
int check(int i, int j) {
  for (int di = -1; di <= 1; di++) {
    for (int dj = -1; dj <= 1; dj++) {
      if (c[di + 1][dj + 1] == 1 && B[i + di][j + dj] == 0) {
        return 0;
      }
    }
  }
  return 1;
}
int main() {
  int n, m, K;
  cin >> n >> m >> K;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++) {
      if (s[j] == '1') {
        B[i + 1][j + 1] = 1;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      A[i][j] = A[i - 1][j] + A[i][j - 1] - A[i - 1][j - 1] + check(i, j);
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 2; j <= n; j++) {
      for (int r = 1, l = 1; l <= m; l++) {
        r = min(m + 1, max(l + 1, r));
        while (r <= m && get(i + 1, j - 1, l + 1, r - 1) < K) {
          r++;
        }
        ans += m + 1 - r;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
