#include <bits/stdc++.h>
using namespace std;
int n, m, x, l[100005], ans;
int main () {
freopen ("lantern.in", "r", stdin);
freopen ("lantern.out", "w", stdout);
cin >> n >> m >> x;
for (int i = 1; i <= n; i++) {
cin >> l[i];
l[i] += l[i - 1];
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++) {
if (l[i] - l[j - 1] >= x && i - j + 1 <= m) {
if (i == j) ans ++;
else ans += 2;
}
}
}
cout << ans;
return 0;
}
/*
3 2 -4 2 3
5 5
*/