#include <bits/stdc++.h>
using namespace std;
const int N = 550;
int n, m, k;
char s[N][N];
long long dp[N][N], cumul[N][N], row[N][N];
long long pre[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> (s[i] + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (s[i][j] == '1' && s[i - 1][j] == '1' && s[i + 1][j] == '1' &&
          s[i][j - 1] == '1' && s[i][j + 1] == '1')
        dp[i][j]++;
      row[i][j] = row[i - 1][j] + dp[i][j];
    }
  long long sol = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 2; j <= n; j++) {
      memset(pre, 0, sizeof pre);
      for (int c = 1; c <= m; c++) pre[c] = row[j][c] - row[i - 1][c];
      for (int c = 1; c <= m; c++) {
        if (dp[i][c]) pre[c]--;
        if (dp[j][c]) pre[c]--;
      }
      for (int c = 1; c <= m; c++) pre[c] += pre[c - 1];
      for (int c = 1; c <= m; c++) {
        if (pre[m] - pre[c] < k) break;
        int lo = c + 1, hi = m;
        while (lo < hi) {
          int mid = (lo + hi) >> 1;
          if (pre[mid - 1] - pre[c] >= k)
            hi = mid;
          else
            lo = mid + 1;
        }
        sol += m - lo + 1;
      }
    }
  }
  cout << sol << endl;
  return 0;
}
