#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  string A[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 1; i < n - 1; i++)
    for (int j = 1; j < m - 1; j++)
      if (A[i][j - 1] > '0' && A[i][j + 1] > '0' && A[i + 1][j] > '0' &&
          A[i - 1][j] > '0' && A[i][j] > '0')
        A[i][j] = '2';
  long long res = 0;
  int C[m];
  for (int i = 1; i < n - 1; i++) {
    for (int q = 0; q < m; q++) C[q] = 0;
    for (int j = i; j < n - 1; j++) {
      for (int q = 0; q < m; q++) C[q] += (A[j][q] == '2');
      int cur = 0;
      int q = 1;
      for (int p = 1; p < m - 1; p++) {
        while (q < m - 1 && cur < k) {
          cur += C[q];
          q++;
        }
        if (cur >= k) {
          res += (m - q);
        }
        cur -= C[p];
      }
    }
  }
  cout << res << endl;
}
