#include <bits/stdc++.h>
using namespace std;
int n,m,x,a[100010],mk[100010];
long long s[100010],res;
int main () {
freopen("lantern.in","r",stdin);
freopen("lantern.out","w",stdout);
cin >> n >> m >> x;
for (int i=1;i<=n;i++) {
cin >> a[i];
s[i]=s[i-1]+a[i];
//cout << s[i] <<endl;
}
for (int l=1;l<=n;l++) {
int sum=0;
for (int r=l;r<=n;r++) {
if (mk[a[r]]==0) {
sum++;
mk[a[r]]=1;
}
//cout << l <<' '<< r <<endl;
if (sum>m) break;
if (s[r]-s[l-1]<x) continue;
if (l==r) res+=1;
else res+=2;
}
memset(mk,0,sizeof(mk));
}
cout << res <<endl;
return 0;
}