#include <bits/stdc++.h>
using namespace std;
const int M = 500 + 5;
int board[M][M], dp[M][M];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++) {
      board[i + 1][j + 1] = s[j] - '0' + 0;
    }
  }
  for (int row = 1; row <= n; row++) {
    for (int col = 1; col <= m; col++) {
      int num = 0;
      num = num + (board[row][col] == 1);
      num = num + (col - 1 >= 1 && col - 1 <= m && board[row][col - 1] == 1);
      num = num + (col + 1 >= 1 && col + 1 <= m && board[row][col + 1] == 1);
      num = num + (row + 1 >= 1 && row + 1 <= n && board[row + 1][col] == 1);
      num = num + (row - 1 >= 1 && row - 1 <= n && board[row - 1][col] == 1);
      dp[row][col] = dp[row][col - 1] + (num == 5);
    }
  }
  long long int ans = 0;
  for (int col1 = 1; col1 <= m; col1++) {
    for (int col2 = col1 + 2; col2 <= m; col2++) {
      int p1 = 1;
      int p2 = 3;
      int numstar = dp[p2 - 1][col2 - 1] - dp[p2 - 1][col1];
      while (p2 <= n) {
        while (p2 <= n && numstar < k) {
          p2++;
          numstar = numstar + dp[p2 - 1][col2 - 1] - dp[p2 - 1][col1];
        }
        if (p2 <= n && numstar >= k) {
          ans = ans + n - p2 + 1;
          numstar = numstar - (dp[p1 + 1][col2 - 1] - dp[p1 + 1][col1]);
          p1++;
          while (p1 + 2 <= p2 && numstar >= k) {
            numstar = numstar - (dp[p1 + 1][col2 - 1] - dp[p1 + 1][col1]);
            p1++;
            ans = ans + n - p2 + 1;
            if (p1 + 2 > p2) {
              break;
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
