#include <bits/stdc++.h>
using namespace std;
int n, m, k;
char s[505][505];
int f[505][505];
bool isStar(int x, int y) {
  return (s[x - 2][y - 1] == '1' && s[x - 1][y - 2] == '1' &&
          s[x - 1][y - 1] == '1' && s[x - 1][y] == '1' && s[x][y - 1] == '1');
}
int getStar(int x1, int y1, int x2, int y2) {
  return f[x2][y2] - f[x1 + 1][y2] - f[x2][y1 + 1] + f[x1 + 1][y1 + 1];
}
int main() {
  scanf("%d %d %d ", &n, &m, &k);
  for (int i = 0; i < n; i++) gets(s[i]);
  for (int i = 0; i < n; i++) f[i][0] = f[i][1] = 0;
  for (int j = 0; j < m; j++) f[0][j] = f[1][j] = 0;
  for (int i = 2; i < n; i++)
    for (int j = 2; j < m; j++) {
      f[i][j] = f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1];
      if (isStar(i, j)) f[i][j]++;
    }
  long long res = 0;
  for (int x1 = 0; x1 + 2 < n; x1++)
    for (int x2 = n - 1; x1 + 2 <= x2; x2--) {
      int s = 0, f = 2;
      while (f < m) {
        int star = getStar(x1, s, x2, f);
        if (star < k)
          f++;
        else if (star >= k) {
          res += m - f;
          s++;
        }
      }
    }
  cout << res << endl;
  return 0;
}
