#include <iostream>
using namespace std;
#include <bits/stdc++.h>
int pairCal(int arr[],int k,int n)
{
int i,j,count=0,sum=0;
for(i=0,j=n-1;i<n && j>=0;i++)
{
sum=arr[i]+arr[j];
while(sum>k && i!=j)
{
j--;
sum=arr[i]+arr[j];
}
if(i==j)
{
break;
}
count+=(j-i);
}
return count;
}
int main() {
// your code goes here
int arr[]={0,1,2,3,4,5,6};
int n;
cin>>n;
sort(arr,arr+n);
int left;
cin>>left;
int right;
cin>>right;
int l=pairCal(arr,left-1,n);
int r=pairCal(arr,right,n);
cout<<r-l;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KCgppbnQgIHBhaXJDYWwoaW50IGFycltdLGludCBrLGludCBuKQogewogICAgCiAgICAJaW50IGksaixjb3VudD0wLHN1bT0wOwogCQlmb3IoaT0wLGo9bi0xO2k8biAmJiBqPj0wO2krKykKCSAgICAgewoJIAlzdW09YXJyW2ldK2FycltqXTsKCSAJd2hpbGUoc3VtPmsgJiYgaSE9aikKCSAJIHsKCSAJIAlqLS07CgkgCSAJc3VtPWFycltpXSthcnJbal07CgkgCSB9CgkgCSBpZihpPT1qKQoJIAkgIHsKCSAJICAJYnJlYWs7CgkgCSAgfQoJIAkgIAoJIAkgIGNvdW50Kz0oai1pKTsKCSAgICAgfQoJICAgICAKCSAgICAgcmV0dXJuIGNvdW50OwogfQoKaW50IG1haW4oKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCgkKCWludCBhcnJbXT17MCwxLDIsMyw0LDUsNn07CglpbnQgbjsKCWNpbj4+bjsKCQogICAgc29ydChhcnIsYXJyK24pOwoJaW50IGxlZnQ7CgljaW4+PmxlZnQ7CglpbnQgcmlnaHQ7CgljaW4+PnJpZ2h0OwoJCglpbnQgbD1wYWlyQ2FsKGFycixsZWZ0LTEsbik7CglpbnQgcj1wYWlyQ2FsKGFycixyaWdodCxuKTsKCQoJY291dDw8ci1sOwogICAgCgkKCXJldHVybiAwOwp9