#include <bits/stdc++.h>
using namespace std;
const int MAX_BUF_SIZE = 16384;
char BUFOR[MAX_BUF_SIZE];
int BUF_SIZE, BUF_POS;
char ZZZ;
const int MXN = 510;
const int C = 262144;
const int INF = 1000000001;
int n, m, k;
int sum[MXN][MXN];
int w[MXN][MXN];
int a[MXN][MXN];
int x[5] = {-1, 0, 1, 0, 0};
int y[5] = {0, 1, 0, -1, 0};
inline int gwiazdka(int oy, int ox) {
  int q = 1;
  for (int i = 0; i < 5; i++)
    if (!a[y[i] + oy][x[i] + ox]) q = 0;
  return q;
}
char str[MXN];
inline int suma(int y1, int x1, int y2, int x2) {
  if (y1 > y2 || x1 > x2) return 0;
  return sum[y2][x2] + sum[y1 - 1][x1 - 1] - sum[y2][x1 - 1] - sum[y1 - 1][x2];
}
long long int res;
void test() {
  scanf("%d %d %d\n", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%s", str);
    for (int j = 0; j < m; j++)
      if (str[j] == '1')
        a[i][j + 1] = 1;
      else
        a[i][j + 1] = 0;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) w[i][j] = gwiazdka(i, j);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) sum[i][j] = sum[i][j - 1] + w[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) sum[i][j] += sum[i - 1][j];
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) {
      int iter = 1;
      for (int o = 1; o < m; o++) {
        while (iter < m && suma(i + 1, o + 1, j - 1, iter - 1) < k) iter++;
        if (suma(i + 1, o + 1, j - 1, iter - 1) >= k) {
          res += (long long int)(m - iter + 1);
        }
      }
    }
  cout << res << endl;
}
int main() {
  int te = 1;
  while (te--) test();
  return 0;
}
