#include <bits/stdc++.h>
using namespace std;
char b[510][510];
int a[510][510];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = (0); i < (n); ++i) scanf("%s", &b[i]);
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (m); ++j)
      if ((i + 2 < n) && (j + 2 < m) && (b[i][j + 1] == '1') &&
          (b[i + 1][j] == '1') && (b[i + 1][j + 1] == '1') &&
          (b[i + 1][j + 2] == '1') && (b[i + 2][j + 1] == '1'))
        a[i][j] = 1;
  for (int i = (0); i < (n); ++i)
    for (int j = (1); j < (m); ++j) a[i][j] += a[i][j - 1];
  for (int i = (1); i < (n); ++i)
    for (int j = (0); j < (m); ++j) a[i][j] += a[i - 1][j];
  long long res = 0;
  for (int i = (0); i < (n - 2); ++i)
    for (int j = (0); j < (m - 2); ++j) {
      int x = i + 2;
      for (int y = m - 1; y >= j + 2; --y) {
        while (1) {
          if (x > n - 1) break;
          int rx = x - 2;
          int ry = y - 2;
          if ((rx < i) || (ry < j)) break;
          int sum = a[rx][ry];
          if (j > 0) sum -= a[rx][j - 1];
          if (i > 0) sum -= a[i - 1][ry];
          if ((i > 0) && (j > 0)) sum += a[i - 1][j - 1];
          if (sum >= k) break;
          x++;
        }
        res += n - x;
      }
    }
  cout << res << endl;
  return 0;
}
