#include <bits/stdc++.h>
using namespace std;
int n, m, k;
string A[505];
bool a[505][505];
int star[505][505];
int col[505][505];
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) a[i][j] = A[i][j] == '1';
  for (int i = 1; i < n - 1; i++)
    for (int j = 1; j < m - 1; j++) {
      if (a[i][j] && a[i - 1][j] && a[i + 1][j] && a[i][j - 1] && a[i][j + 1])
        star[i][j] = 1;
    }
  for (int j = 0; j < m; j++) {
    col[j][0] = 0;
    for (int i = 0; i < n; i++) col[j][i + 1] = col[j][i] + int(star[i][j]);
  }
  long long res = 0;
  for (int i1 = 0; i1 < n; i1++)
    for (int i2 = i1 + 3; i2 < n + 1; i2++) {
      int z[m];
      for (int j = 1; j < m - 1; j++) z[j] = col[j][i2 - 1] - col[j][i1 + 1];
      int s = 0, j2 = 1;
      for (int j1 = 1; j1 < m - 1; j1++) {
        while (s < k) s += z[j2++];
        res += m - j2;
        s -= z[j1];
      }
    }
  cout << res << endl;
}
