#include #include #include #include #include #include #include using namespace std; typedef double db; typedef long long ll; typedef unsigned long long ull; inline void Max(ll &a,ll b){if(ab||a==-1)a=b;} inline void rd(ll &a){ a=0;char c; while(c=getchar(),!isdigit(c)); do a=a*10+(c^48); while(c=getchar(),isdigit(c)); } const int M=1e5+5; ll A[M],dlt[M]; inline void gao(){ ll n,L,R;cin>>n>>L>>R; for(int i=1;i<=n;++i)rd(A[i]); sort(A+1,A+n+1); A[n+1]=(ll)3e18,A[n+2]=(ll)6e18; for(int i=1;i<=n+1;++i) dlt[i]=A[i+1]-A[i]; for(int i=n;i;--i)Min(dlt[i],dlt[i+1]); ll ans=0; for(int i=1;i<=n;++i){//[A[i],A[i+1]) ll mi=A[i-1]+A[i]; ll mx=A[i+1]-A[i]; ll l=max(L,mi),r=min(R,mx); Max(l,A[i]),Min(r,A[i+1]-1); Min(r,dlt[i+1]); ans+=max(r-l+1,(ll)0); }//left ll left=min(dlt[1],R); Min(left,A[1]-1); ans+=max(left-L+1,(ll)0); cout<