#include <bits/stdc++.h>
using namespace std;
int nRow, nCol, nPoint, val[2510][2510], sum[2510][2510];
void read() {
  static char str[2510];
  scanf("%d %d %d", &nRow, &nCol, &nPoint);
  for (int i = 1; i <= nRow; ++i) {
    scanf("%s", str + 1);
    for (int j = 1; j <= nCol; ++j) {
      val[i][j] = str[j] - '0';
      sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + val[i][j];
    }
  }
}
int getsum(int lx, int ly, int rx, int ry) {
  return sum[rx][ry] - sum[lx - 1][ry] - sum[rx][ly - 1] + sum[lx - 1][ly - 1];
}
long long Divide(int lx, int ly, int rx, int ry) {
  if (lx == rx && ly == ry) return val[lx][ly] == nPoint;
  long long ans = 0;
  if (rx - lx > ry - ly) {
    int mid = (lx + rx) >> 1;
    for (int i = ly; i <= ry; ++i) {
      int cnt[2][7] = {0};
      for (int j = ry; j >= i; --j) {
        for (int h = 0; h <= nPoint; ++h) {
          while (mid - cnt[0][h] >= lx &&
                 getsum(mid - cnt[0][h], i, mid, j) <= h)
            ++cnt[0][h];
          while (mid + cnt[1][h] + 1 <= rx &&
                 getsum(mid + 1, i, mid + cnt[1][h] + 1, j) <= h)
            ++cnt[1][h];
        }
        for (int h = 0; h <= nPoint; ++h) {
          long long suma = h == 0 ? cnt[0][h] : cnt[0][h] - cnt[0][h - 1];
          long long sumb = h == nPoint
                               ? cnt[1][nPoint - h]
                               : cnt[1][nPoint - h] - cnt[1][nPoint - h - 1];
          ans = ans + suma * sumb;
        }
      }
    }
    return ans + Divide(lx, ly, mid, ry) + Divide(mid + 1, ly, rx, ry);
  } else {
    int mid = (ly + ry) >> 1;
    for (int i = lx; i <= rx; ++i) {
      int cnt[2][7] = {0};
      for (int j = rx; j >= i; --j) {
        for (int h = 0; h <= nPoint; ++h) {
          while (mid - cnt[0][h] >= ly &&
                 getsum(i, mid - cnt[0][h], j, mid) <= h)
            ++cnt[0][h];
          while (mid + cnt[1][h] + 1 <= ry &&
                 getsum(i, mid + 1, j, mid + cnt[1][h] + 1) <= h)
            ++cnt[1][h];
        }
        for (int h = 0; h <= nPoint; ++h) {
          long long suma = h == 0 ? cnt[0][h] : cnt[0][h] - cnt[0][h - 1];
          long long sumb = h == nPoint
                               ? cnt[1][nPoint - h]
                               : cnt[1][nPoint - h] - cnt[1][nPoint - h - 1];
          ans = ans + suma * sumb;
        }
      }
    }
    return ans + Divide(lx, ly, rx, mid) + Divide(lx, mid + 1, rx, ry);
  }
}
int main() {
  read();
  cout << Divide(1, 1, nRow, nCol) << endl;
  return 0;
}
