#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main()
{
   int t;
   cin>>t;
   ll sum3 = 0;
   while(t--)
   {
       ll a,b;
       cin>>a>>b;
       a--;
       ll sum1 = (a*(a+1))/2;
       ll sum2 = (b*(b+1))/2;
        sum3 +=  sum2-sum1;

   }
   cout<<sum3<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0);
    cout.tie(0);
    int n,i,s=0;
    cin>>n;
    int A[n];
    for(i=0;i<n;i++)
    {
        cin>>A[i];
        if(A[i]<=10)
        {
            A[i]=0;
        }
        else
        {
            A[i]=A[i]-10;
        }
        s+=A[i];
    }
    cout<<s<<endl;
    return 0;
}
