#include <bits/stdc++.h>
using namespace std;
char s[600][600];
int a[600][600];
long long sum[600][600];
int row[600];
int main() {
  long long n, m, k, run, ans = 0, temp;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 1; i < n - 1; i++)
    for (int j = 1; j < m - 1; 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')
        a[i + 1][j + 1] = 1;
    }
  for (int i = 1; i <= n; i++) {
    sum[i][1] = sum[i - 1][1] + a[i][1];
  }
  for (int j = 1; j <= m; j++) sum[1][j] = sum[1][j - 1] + a[1][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + a[i][j];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      run = j;
      temp = 0;
      for (int l = 1; l <= i; l++) {
        while (run > 0 && sum[i - 1][j - 1] - sum[i - 1][run] - sum[l][j - 1] +
                                  sum[l][run] <
                              k)
          run--;
        ans += run;
        temp += run;
      }
    }
  }
  cout << ans << endl;
  scanf(" ");
}
