#include <fstream>
#include <cstdio>
#include <unordered_map>
#define MAXN 1050000
using namespace std;
int n, L, U;
unsigned int a[MAXN];
long long sol;
long long tot(int ma)
{
unordered_map<unsigned int, int> m;
int sz = 0, ind = 1;
long long part = 0;
for (int i = 1; i <= n; i++)
{
sz += ((++m[a[i]])==1);
for (; sz > ma; ind++)
sz -= ((--m[a[ind]])==0);
part += i-ind+1;
}
return part;
}
void solve()
{
sol = tot(U) - tot(L-1);
}
int main()
{
ifstream fin("secv5.in");
ofstream fout("secv5.out");
fin >> n >> L >> U;
for (int i = 1; i <= n; i++)
fin >> a[i];
solve();
fout << sol;
return 0;
}