#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 1e9;
const long long INF64 = 3e18;
const long double EPS = 1e-12;
const long double PI = 3.1415926535897932384626433832795028841;
const long long MD = 925262732;
const long long T = 634521;
const int N = 400100;
const int M = 501;
int n, m, k, aa[M][M], a[M][M], d[M][M];
long long ans = 0;
string s;
int get(int first, int second) {
  if (first < 0 || second < 0) return 0;
  return d[first][second];
}
int ss(int x1, int y1, int x2, int y2) {
  int sum = get(x2, y2);
  sum -= get(x2, y1 - 1) + get(x1 - 1, y2) - get(x1 - 1, y1 - 1);
  return sum;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < int(n); i++) {
    cin >> s;
    for (int j = 0; j < int(m); j++)
      if (s[j] == '1') aa[i][j] = 1;
  }
  for (int i = 1; i < n - 1; i++)
    for (int j = 1; j < m - 1; j++)
      if (aa[i][j] && aa[i - 1][j] && aa[i + 1][j] && aa[i][j + 1] &&
          aa[i][j - 1])
        a[i][j] = 1;
  for (int i = 0; i < int(n); i++)
    for (int j = 0; j < int(m); j++)
      d[i][j] = a[i][j] + get(i - 1, j) + get(i, j - 1) - get(i - 1, j - 1);
  for (int i = 0; i < n; i++)
    for (int j = i + 2; j < n; j++) {
      int r = 0, sum = 0;
      for (int l = 0; l < m; l++) {
        while (r + 1 < m && sum < k) {
          r++;
          if (l != r - 1) sum += ss(i + 1, r - 1, j - 1, r - 1);
        }
        if (sum >= k)
          ans += m - r;
        else
          break;
        sum -= ss(i + 1, l + 1, j - 1, l + 1);
      }
    }
  cout << ans;
  return 0;
}
