#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 (s[r]-s[l-1]>=x) {
int p=0;
for (int k=l;k<=r;k++)
{
if(mk[a[k]]==0)
{
mk[a[k]]=1;
p++;
}
}
if (p<=m) {
if (l==r) res++;
else res+=2;
}
for(int k=l;k<=r;k++)
{
mk[a[k]]=0;
}
}
}
//memset(mk,0,sizeof(mk));
}
cout << res <<endl;
return 0;
}