/*#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;

ll a[200005];
ll pre[200005];
ll sum[200005];


int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=1;i<n;i++)
    {
        int val =a[i]-k;

        int idx=lower_bound(a,a+i+1,val)-a;
        int idx2=lower_bound(a,a+i+1,a[i])-a;
        if(idx==i) continue;
         pre[idx]+=1;

        pre[idx2]-=1;

    }
    sum[0]=pre[0];
    for(int i=1;i<n;i++)
    {
        sum[i]=sum[i-1]+pre[i];
    }
    ll cnt=0;
    for(int i=0;i<n;i++)
    {
        if(sum[i]<=0)
        {
            cnt++;
        }

    }
    cout<<cnt<<endl;
}*/

/*#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int freq[300005];
map<ll,ll>mpp;
stack<char>st;
int main()
{
    int n;
    cin>>n;
    ll cnt=0;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        int len=s.length();
        int aa=0;
        int f=0,ff=0,mm=0;
        for(int j=0;j<len;j++)
        {
            if(st.empty())
            {
                if(s[j]==')')
                {
                    aa--;
                    ff=1;
                }
                else
                {
                    st.push('(');
                    aa++;

                }
                continue;
            }

            char c = st.top();
            if(s[j]==')')
            {
                if(c=='(')
                {
                    st.pop();
                    aa--;
                }
            }
            else
            {
                if(c==')')
                {
                    mm=1;
                    break;
                }
                else
                {
                    f=1;
                    st.push('(');
                    aa++;
                }
            }
        }
        if(mm==1)

        if(f==1 && ff==1)
        {
            continue;
        }
        freq[i]=aa;

        if(freq[i]==0)
        {
            cnt++;
        }
    }
    ll ans=0;
    ans=ans+1LL*cnt*cnt;
    for(int i=0;i<n;i++)
    {
        if(freq[i]!=0)
        {
            mpp[freq[i]]++;
        }
        int x=-freq[i];
        ans=ans+mpp[x];
    }
    cout<<ans<<endl;
}*/

/*#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;

ll a[200005];
ll pre[200005];
ll sum[200005];


int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=1;i<n;i++)
    {
        int val =a[i]-k;

        int idx=lower_bound(a,a+i+1,val)-a;
        int idx2=lower_bound(a,a+i+1,a[i])-a;
        if(idx==i) continue;
         pre[idx]+=1;

        pre[idx2]-=1;

    }
    sum[0]=pre[0];
    for(int i=1;i<n;i++)
    {
        sum[i]=sum[i-1]+pre[i];
    }
    ll cnt=0;
    for(int i=0;i<n;i++)
    {
        if(sum[i]<=0)
        {
            cnt++;
        }

    }
    cout<<cnt<<endl;
}*/

/*#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int freq[300005];
map<ll,ll>mpp;
int main()
{
    int n;
    cin>>n;
    ll cnt=0;
    stack<char>st;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        while(!st.empty())
        {
            st.pop();
        }
        int len=s.length();
        int m=0,f=0,ff=0;
        for(int j=0;j<len;j++)
        {
            if(st.empty())
            {
                st.push(s[j]);
                continue;
            }
            char c = st.top();
            if(s[j]==')')
            {
                if(c=='(')
                {
                    st.pop();
                }
            }
            else
            {
                if(c==')')
                {
                    m=1;
                    break;
                }
                else st.push('(');
            }
        }
        if(m)
        {
            continue;
        }
        for(int j=0;j<len;j++)
        {
            if(s[j]==')')
            {
                freq[i]--;
            }
            else freq[i]++;
        }
        if(freq[i]==0)
        {
            cnt++;
        }
    }
    ll ans=0;
    ans=ans+1LL*cnt*cnt;
    for(int i=0;i<n;i++)
    {
        if(freq[i]!=0)
        {
            mpp[freq[i]]++;
        }
        int x=-freq[i];
        ans=ans+mpp[x];
    }
    cout<<ans<<endl;
}
*/

/*
    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    string s;
    int freq[300005];
    map<ll,ll>mpp;
    int main()
    {
        int n;
        cin>>n;
        ll cnt=0;
        for(int i=0;i<n;i++)
        {
            cin>>s;
            int len=s.length();

            for(int j=0;j<len;j++)
            {
                if(s[j]==')')
                {
                    freq[i]--;
                }
                else freq[i]++;
            }
            if(freq[i]==0)
            {
                cnt++;
            }
        }
        ll ans=0;
        ans=ans+1LL*cnt*cnt;
        for(int i=0;i<n;i++)
        {
            if(freq[i]!=0)
            {
                mpp[freq[i]]++;
            }
            int x=-freq[i];
            ans=ans+mpp[x];
        }
        cout<<ans<<endl;
    }
*/


#include <bits/stdc++.h>
using namespace std;
int x[1005];
int main()
{
    int a,b;
    int n;
    cin>>a>>b;
    int diff = b-a;
    int val = diff*(diff-1)/2;
    cout<<val-a<<endl;
    return 0;
}


Measured memory_bytes: 256