#include <bits/stdc++.h>
using namespace std;
const int MaxN = 505;
const int dx[] = {-1, 1, 0, 0, 0};
const int dy[] = {0, 0, -1, 1, 0};
char mp[MaxN][MaxN];
int dp[MaxN][MaxN];
int r, c, K;
int check(int x, int y) {
  for (int i = 0; i < 5; i++)
    if (mp[x + dx[i]][y + dy[i]] != '1') return 0;
  return 1;
}
int doit(int x1, int y1, int x2, int y2) {
  if (x2 - x1 <= 1 || y2 - y1 <= 1) return 0;
  x2--;
  y2--;
  return dp[x2][y2] - dp[x1][y2] - dp[x2][y1] + dp[x1][y1];
}
long long doit() {
  long long ret = 0;
  for (int i = 1; i <= r; i++)
    for (int j = 1; j <= c; j++)
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + check(i, j);
  for (int i = 1; i <= r; i++)
    for (int j = 1; j <= c; j++)
      for (int k = i + 2, p = c; k <= r; k++) {
        if (doit(i, j, k, p) < K) continue;
        while (doit(i, j, k, p - 1) >= K) p--;
        ret += c - p + 1;
      }
  return ret;
}
int main() {
  while (scanf("%d%d%d", &r, &c, &K) == 3) {
    for (int i = 1; i <= r; i++) scanf("%s", mp[i] + 1);
    cout << doit() << endl;
  }
  return 0;
}
