#include <bits/stdc++.h>
using namespace std;
int a[511][511];
int b[511][511];
int c[511];
int n, m, k;
long long Ans = 0LL;
bool Input();
int Star(int x, int y);
bool check();
int GetChar();
bool Init();
bool Solve();
bool Optimize(int y0, int y1);
int main() {
  Input();
  Init();
  Solve();
  cout << Ans << endl;
  return 0;
}
bool Optimize(int y0, int y1) {
  if (y1 - 1 < y0 + 1) return true;
  c[0] = 0;
  for (int i = 1; i <= n; i++) c[i] = c[i - 1] + b[i][y1 - 1] - b[i][y0];
  int i = 1, j = 1;
  while (j <= n) {
    while (c[j] - c[i] < k && j <= n - 1) j++;
    if (j >= n) break;
    Ans = Ans + n - j;
    i++;
    if (i == n) break;
  }
  return true;
}
bool Solve() {
  for (int i = 1; i <= m; i++)
    for (int j = i; j <= m; j++) Optimize(i, j);
  return true;
}
bool Init() {
  for (int i = 1; i <= n; i++) {
    b[i][0] = 0;
    for (int j = 1; j <= m; j++) b[i][j] = b[i][j - 1] + Star(i, j);
  }
  Ans = 0;
  return true;
}
bool check(int x, int y) {
  if (x * y == 0) return false;
  if (a[x][y] == 1) return true;
  return false;
}
int Star(int x, int y) {
  if (!check(x, y)) return 0;
  if (!check(x - 1, y)) return 0;
  if (!check(x + 1, y)) return 0;
  if (!check(x, y - 1)) return 0;
  if (!check(x, y + 1)) return 0;
  return 1;
}
int GetChar() {
  char c;
  do {
    cin >> c;
    if (c == '0') return 0;
    if (c == '1') return 1;
  } while (1 != 0);
  return -1;
}
bool Input() {
  cin >> n >> m >> k;
  int i, j;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) a[i][j] = GetChar();
  return true;
}
