#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 5e2 + 10;
long long n, m, T, ans;
long long Arr[MAX_N][MAX_N];
long long table[MAX_N][MAX_N];
long long psum[MAX_N][MAX_N];
long long tmp[MAX_N];
long long P[MAX_N];
string s;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m >> T;
  if (min(n, m) <= 2) {
    cout << "0\n";
    return 0;
  }
  for (long long i = 0; i < n; i++) {
    cin >> s;
    for (long long j = 0; j < m; j++) Arr[i][j] = (s[j] == '1');
  }
  for (long long i = 1; i + 1 < n; i++)
    for (long long j = 1; j + 1 < m; j++)
      table[i][j] = (Arr[i][j] && Arr[i - 1][j] && Arr[i + 1][j] &&
                     Arr[i][j - 1] && Arr[i][j + 1]);
  n -= 2, m -= 2;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++)
      psum[i][j] = table[i][j] + psum[i - 1][j];
  for (long long i = 1; i <= n; i++)
    for (long long j = i; j <= n; j++) {
      for (long long k = 1; k <= m; k++) tmp[k] = psum[j][k] - psum[i - 1][k];
      for (long long k = 1; k <= m; k++) P[k] = P[k - 1] + tmp[k];
      long long ind = 1;
      for (long long k = 1; k <= m; k++) {
        while (ind < k && P[k] - P[ind] >= T) ind++;
        if (P[k] - P[ind - 1] >= T) ans += ind;
      }
    }
  cout << ans << "\n";
  return 0;
}
