#include <bits/stdc++.h>
using namespace std;
const int NMAX = 504;
char s[NMAX][NMAX];
int b[NMAX][NMAX];
int sum[NMAX][NMAX];
int n, m, k, v[NMAX];
int main() {
  cin.sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) cin >> (s[i] + 1);
  if (n < 3 || m < 3) {
    cout << "0\n";
    return 0;
  }
  for (int i = 2; i < n; ++i)
    for (int j = 2; j < m; ++j)
      if (s[i][j] == '1' && s[i][j - 1] == '1' && s[i][j + 1] == '1' &&
          s[i - 1][j] == '1' && s[i + 1][j] == '1')
        b[i][j] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) sum[i][j] = sum[i - 1][j] + b[i][j];
  long long sol = 0;
  for (int line1 = 1; line1 <= n - 2; ++line1) {
    for (int line2 = line1 + 2; line2 <= n; ++line2) {
      for (int j = 1; j <= m; ++j) v[j] = sum[line2 - 1][j] - sum[line1][j];
      int j = 3;
      int p = v[2];
      for (int i = 1;; ++i) {
        while (p < k && j <= m) {
          p += v[j];
          j++;
        }
        if (j > m) break;
        sol += m - j + 1;
        p -= v[i + 1];
      }
    }
  }
  cout << sol << "\n";
  return 0;
}
