#include <bits/stdc++.h>
using namespace std;
void getint(int &v) {
  char ch, fu = 0;
  for (ch = '*'; (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
    ;
  if (ch == '-') fu = 1, ch = getchar();
  for (v = 0; ch >= '0' && ch <= '9'; ch = getchar()) v = v * 10 + ch - '0';
  if (fu) v = -v;
}
vector<int> M, V, v[2510];
int mm, nn, cnt[2510][8], D[2510][2510], a[2510][2510], s[2510][2510], K,
    R[2510][2510], n, m;
char S[2510];
long long ans;
int sum(int S, int X, int Z, int Y) {
  return (s[X][Y] - s[S - 1][Y] - s[X][Z - 1] + s[S - 1][Z - 1]);
}
void solve(int S, int X, int Z, int Y) {
  if (S == X && Z == Y) {
    ans += (a[S][Z] == K);
    return;
  }
  if (X - S > Y - Z) {
    int m = (S + X) / 2;
    for (int i = Z; i <= Y; ++i) {
      for (int j = Z; j <= Y; ++j) v[j].clear();
      for (int j = m; j >= S; --j)
        if (R[j][i] <= mm) v[R[j][i]].push_back(j);
      V.clear();
      V.push_back(m);
      V.push_back(S - 1);
      for (int j = i; j <= Y; ++j) {
        M.clear();
        int A = 0, B = 0;
        while (A < V.size() || B < v[j].size()) {
          if (A < V.size() && (B >= v[j].size() || V[A] > v[j][B]))
            M.push_back(V[A]), ++A;
          else
            M.push_back(v[j][B]), ++B;
        }
        V.clear();
        for (int k = 0; k <= K; ++k) cnt[j][k] = 0;
        for (int k = 0; k + 1 < M.size(); ++k) {
          int t = sum(M[k], m, i, j);
          V.push_back(M[k]);
          if (t > K) break;
          cnt[j][t] += M[k] - M[k + 1];
        }
        V.push_back(S - 1);
      }
      for (int j = Z; j <= Y; ++j) v[j].clear();
      for (int j = m + 1; j <= X; ++j)
        if (R[j][i] <= mm) v[R[j][i]].push_back(j);
      V.clear();
      V.push_back(m + 1);
      V.push_back(X + 1);
      for (int j = i; j <= Y; ++j) {
        M.clear();
        int A = 0, B = 0;
        while (A < V.size() || B < v[j].size()) {
          if (A < V.size() && (B >= v[j].size() || V[A] < v[j][B]))
            M.push_back(V[A]), ++A;
          else
            M.push_back(v[j][B]), ++B;
        }
        V.clear();
        for (int k = 0; k + 1 < M.size(); ++k) {
          int t = sum(m + 1, M[k], i, j);
          V.push_back(M[k]);
          if (t > K) break;
          ans += 1ll * (M[k + 1] - M[k]) * cnt[j][K - t];
        }
        V.push_back(X + 1);
      }
    }
    solve(S, m, Z, Y);
    solve(m + 1, X, Z, Y);
  } else {
    int m = (Z + Y) / 2;
    for (int i = S; i <= X; ++i) {
      for (int j = S; j <= X; ++j) v[j].clear();
      for (int j = m; j >= Z; --j)
        if (D[i][j] <= nn) v[D[i][j]].push_back(j);
      V.clear();
      V.push_back(m);
      V.push_back(Z - 1);
      for (int j = i; j <= X; ++j) {
        M.clear();
        int A = 0, B = 0;
        while (A < V.size() || B < v[j].size()) {
          if (A < V.size() && (B >= v[j].size() || V[A] > v[j][B]))
            M.push_back(V[A]), ++A;
          else
            M.push_back(v[j][B]), ++B;
        }
        V.clear();
        for (int k = 0; k <= K; ++k) cnt[j][k] = 0;
        for (int k = 0; k + 1 < M.size(); ++k) {
          int t = sum(i, j, M[k], m);
          V.push_back(M[k]);
          if (t > K) break;
          cnt[j][t] += M[k] - M[k + 1];
        }
        V.push_back(Z - 1);
      }
      for (int j = S; j <= X; ++j) v[j].clear();
      for (int j = m + 1; j <= Y; ++j)
        if (D[i][j] <= nn) v[D[i][j]].push_back(j);
      V.clear();
      V.push_back(m + 1);
      V.push_back(Y + 1);
      for (int j = i; j <= X; ++j) {
        M.clear();
        int A = 0, B = 0;
        while (A < V.size() || B < v[j].size()) {
          if (A < V.size() && (B >= v[j].size() || V[A] < v[j][B]))
            M.push_back(V[A]), ++A;
          else
            M.push_back(v[j][B]), ++B;
        }
        V.clear();
        for (int k = 0; k + 1 < M.size(); ++k) {
          int t = sum(i, j, m + 1, M[k]);
          V.push_back(M[k]);
          if (t > K) break;
          ans += 1ll * (M[k + 1] - M[k]) * cnt[j][K - t];
        }
        V.push_back(Y + 1);
      }
    }
    solve(S, X, Z, m);
    solve(S, X, m + 1, Y);
  }
}
int main() {
  cin >> n >> m >> K;
  nn = n, mm = m;
  for (int i = 1; i <= n; ++i) {
    scanf("%s", S + 1);
    for (int j = 1; j <= m; ++j) a[i][j] = S[j] - '0';
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + a[i][j];
  for (int i = 1; i <= n; ++i) {
    int t = m + 1;
    for (int j = m; j >= 1; --j) {
      if (a[i][j]) t = j;
      R[i][j] = t;
    }
  }
  for (int j = 1; j <= m; ++j) {
    int t = n + 1;
    for (int i = n; i >= 1; --i) {
      if (a[i][j]) t = i;
      D[i][j] = t;
    }
  }
  solve(1, n, 1, m);
  cout << ans << endl;
  return 0;
}
