#include <bits/stdc++.h>
using namespace std;
char cit[510][510];
int sp[510][510];
int n, m, k;
long long ans;
int sum(int st, int dr, int up, int down);
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i(1); i <= n; i++) {
    cin >> cit[i] + 1;
    for (int j(1); j <= m; j++) {
      sp[i][j] = sp[i - 1][j] + sp[i][j - 1] - sp[i - 1][j - 1];
      if (i - 2 >= 1 && j - 2 >= 1 && cit[i - 1][j - 1] == '1' &&
          cit[i - 1][j] == '1' && cit[i][j - 1] == '1' &&
          cit[i - 1][j - 2] == '1' && cit[i - 2][j - 1] == '1')
        sp[i][j]++;
    }
  }
  for (int st(1); st <= m; st++) {
    for (int down(1); down <= n; down++) {
      int prec(1);
      for (int up(1); up < down; up++) {
        while (sum(st, st + prec, up, down) < k && st + prec <= m) prec++;
        if (st + prec > m) break;
        ans += m - st - prec + 1;
      }
    }
  }
  cout << ans;
  return 0;
}
int sum(int st, int dr, int up, int down) {
  return sp[down][dr] + sp[up + 1][st + 1] - sp[up + 1][dr] - sp[down][st + 1];
}
