#include <bits/stdc++.h>
using namespace std;
const int MAXN = 510;
int height;
int width;
char photo[MAXN][MAXN];
int sum[MAXN][MAXN];
int countStar(int col, int loRow, int hiRow) {
  if (loRow > hiRow) return 0;
  hiRow++;
  return sum[hiRow][col] - sum[loRow][col];
}
bool isStarCenter(int i, int j) {
  return i > 0 && i < height - 1 && j > 0 && j < width - 1 &&
         photo[i][j] == '1' && photo[i - 1][j] == '1' &&
         photo[i + 1][j] == '1' && photo[i][j - 1] == '1' &&
         photo[i][j + 1] == '1';
}
int main(void) {
  cin >> height >> width;
  if (height < 3 || width < 3) {
    cout << 0 << endl;
    return 0;
  }
  int starNeeded;
  cin >> starNeeded;
  for (int i = 0; i < (height); ++i) cin >> photo[i];
  memset(sum, 0, sizeof sum);
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      sum[i + 1][j] = sum[i][j] + (isStarCenter(i, j) ? 1 : 0);
    }
  }
  long long answer = 0;
  for (int loRow = 0; loRow < height; loRow++) {
    for (int hiRow = loRow + 1; hiRow < height; hiRow++) {
      int loCol = 0;
      int hiCol = 1;
      int currentStar = 0;
      long long count = 0;
      while (hiCol < width) {
        bool tag = false;
        while (currentStar < starNeeded) {
          if (hiCol == width - 1) {
            tag = true;
            break;
          }
          currentStar += countStar(hiCol, loRow + 1, hiRow - 1);
          hiCol++;
        }
        if (tag) break;
        while (currentStar >= starNeeded) {
          count += width - hiCol;
          currentStar -= countStar(loCol + 1, loRow + 1, hiRow - 1);
          loCol++;
        }
      }
      answer += count;
    }
  }
  cout << answer << endl;
  return 0;
}
