#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
const int mm = 505;
int n, m, k;
char c[mm][mm];
int a[mm][mm];
int dx[5] = {0, 1, 0, -1, 0};
int dy[5] = {0, 0, 1, 0, -1};
bool check(int x, int y) {
  for (int i = 0; i < 5; i++)
    if (x + dx[i] == 0 || x + dx[i] > n || y + dy[i] == 0 || y + dy[i] > m ||
        c[x + dx[i]][y + dy[i]] - '1')
      return 0;
  return 1;
}
void nhap() {
  scanf("%d %d %d\n", &n, &m, &k);
  for (int i = 1; i <= n; i++, scanf("\n"))
    for (int j = 1; j <= m; j++) scanf("%c", &c[i][j]);
}
int get(int i, int j, int x, int y) {
  if (x - 1 < i + 1 || y - 1 < j + 1) return 0;
  return a[x - 1][y - 1] - a[x - 1][j] - a[i][y - 1] + a[i][j];
}
void xuli() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      a[i][j] = a[i][j - 1] + a[i - 1][j] - a[i - 1][j - 1] + check(i, j);
  long long re = 0;
  for (int i = 3; i <= n; i++)
    for (int j = 3; j <= m; j++) {
      int l = 3;
      for (int z = 1; z <= i - 2; z++) {
        if (get(z, 1, i, j) < k) break;
        while (l < j && get(z, j - l, i, j) < k) l++;
        if (get(z, j - l + 1, i, j) < k && l < j && get(z, j - l, i, j) >= k)
          l++;
        if (get(z, j - l + 1, i, j) >= k) re += (long long)(j - l + 1);
      }
    }
  printf("%lld", re);
}
int main() {
  nhap();
  xuli();
}
