#include <bits/stdc++.h>
using namespace std;
const int MaxN = 500 + 5;
const int MaxM = 500 + 5;
const int MaxK = 500 + 5;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int N, M, K, DP[MaxN][MaxM];
char Photo[MaxN][MaxM];
inline int Query(int X1, int Y1, int X2, int Y2) {
  return DP[X2][Y2] - DP[X1 - 1][Y2] - DP[X2][Y1 - 1] + DP[X1 - 1][Y1 - 1];
}
int main(void) {
  scanf("%d %d %d", &N, &M, &K);
  getchar();
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) Photo[i][j] = getchar();
    getchar();
  }
  memset(DP, 0, sizeof(DP));
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++) {
      int Cnt = 0;
      for (int k = 0; k < 4; k++) Cnt += (Photo[i + dx[k]][j + dy[k]] == '1');
      DP[i][j] = DP[i - 1][j] + DP[i][j - 1] - DP[i - 1][j - 1] +
                 ((Cnt == 4) && (Photo[i][j] == '1'));
    }
  long long int Sol = 0LL;
  for (int i = 1; i <= N; i++)
    for (int j = i + 2; j <= N; j++) {
      if (Query(i + 1, 2, j - 1, M - 1) < K) continue;
      int Left = 1;
      for (int k = 3; k <= M; k++) {
        while ((Left <= k) && (Query(i + 1, Left + 2, j - 1, k - 1) >= K))
          Left++;
        if (Query(i + 1, Left + 1, j - 1, k - 1) >= K) Sol += Left;
      }
    }
  cout << Sol << endl;
  return 0;
}
