#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e3 + 10;
long long n, m, T, ans, A[MAXN][MAXN], B[MAXN][MAXN], C[MAXN][MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> T;
  for (long long i = 1; i <= n; i++) {
    string s;
    cin >> s;
    for (long long j = 1; j <= m; j++) {
      A[i][j] = s[j - 1] - 48;
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; 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)
        B[i][j] = 1;
    }
    partial_sum(B[i], B[i] + MAXN, C[i]);
  }
  for (long long i = 1; i <= m; i++) {
    for (long long j = i + 2; j <= m; j++) {
      long long cnt = 0, ind = 2;
      for (long long k = 1; k <= n; k++) {
        while (ind <= n && cnt < T) {
          cnt += C[ind][j - 1] - C[ind][i];
          ind++;
        }
        ans += (n - ind + 1);
        cnt -= C[k + 1][j - 1] - C[k + 1][i];
      }
    }
  }
  cout << ans << endl;
}
