#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[505][505], d[505];
long long result;
string s[505];
int main() {
  cin >> m >> n >> k;
  for (int i = 0; i < m; i++) cin >> s[i];
  for (int i = 1; i < m - 1; i++)
    for (int j = 1; j < n - 1; j++)
      if (s[i][j] == '1' && s[i - 1][j] == '1' && s[i][j - 1] == '1' &&
          s[i + 1][j] == '1' && s[i][j + 1] == '1')
        a[i][j] = 1;
  m--;
  n--;
  for (int i = 1; i < m; i++)
    for (int j = 1; j < n; j++)
      a[i][j] = a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1] + a[i][j];
  for (int top = 1; top < m; top++)
    for (int bot = top; bot < m; bot++) {
      for (int col = 1; col < n; col++)
        d[col] = a[bot][col] - a[top - 1][col] - a[bot][col - 1] +
                 a[top - 1][col - 1];
      for (int i = 1; i < n; i++) d[i] = d[i - 1] + d[i];
      int last = 1;
      for (int i = 0; i < n; i++) {
        while (last < n && d[last] - d[i] < k) last++;
        result += n - last;
      }
    }
  cout << result;
}
