/*HAR HAR MAHADEV
ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/
# include   <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;//typedef for datatype and #define for macro

# define    fast                ios_base::sync_with_stdio(false);cin.tie(NULL);
# define    MOD                 1000000007
# define    endl                '\n'
# define    FOR(i, a, b)        for (int i=a; i<(b); i++)
# define    F0R(i, a)           for (int i=0; i<(a); i++)
# define    FORd(i,a,b)         for (int i = (b)-1; i >= a; i--)
# define    F0Rd(i,a)           for (int i = (a)-1; i >= 0; i--)
# define    INF                 9e18
# define    PI                  3.14159265358979323846
# define    lb                  lower_bound
# define    ub                  upper_bound
# define    mp                  make_pair
# define    pb                  push_back
# define    fi                  first
# define    se                  second
# define    all(a)              a.begin(), a.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
    fast;
    ll t = 1;
    // cin >> t;
    while (t--)
    {
        ll n, sum = 0;
        cin >> n;
        while (n--)
        {
            ll a, b;
            cin >> a >> b;
            sum += ((b * (b + 1)) / 2) - ((a * (a + 1)) / 2) + a;
        }
        cout << sum << endl;
        return 0;
    }
    return 0;
}
/* stuff you should look for
  * int overflow, array bounds
  * special cases (n=1?)
  * do smth instead of nothing and stay organized
  * WRITE STUFF DOWN
  * DON'T GET STUCK ON ONE APPROACH
*/
  #include<bits/stdc++.h>

/*

shinchanCoder Here!!

*/

using namespace std;

#define endll "\n"
#define pb push_back
#define all(x) begin(x), end(x)
#define allr(x) rbegin(x), rend(x)
#define forn(i,n) for(ll i=0;i<(n);i++)

#define sz(x) (int)(x).size()

#define ff first
#define ss second

#define mpr make_pair

#define len(x) x.length()

#define ll long long
#define ld long double
#define lli long long int

#define mod 1000000007

ll powmod(ll a,  ll b){
    if(b==0){
        return 1 ;
    }
    ll x = powmod(a,b/2);
    x = (x*x)%mod ;
    if(b%2){
        x = (a*x)%mod ;
    }
    return x;
}

ll power(ll x, ll y) {
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}


vector<ll> prm;

void Sieve(ll n) {
  bool prime[n+1];
  memset(prime,true, sizeof(prime));
  for(ll p=2;p*p<=n;p++) {
    if(prime[p]==true) {
      for(ll i=p*p;i<=n;i+=p) {
        prime[i]=false;
      }
    }
  }
  if(!prm.empty()) {
    prm.clear();
  }
  for(ll p=2;p<=n;p++) {
    if(prime[p]) {
      prm.pb(p);
    }
  }
}

ll fact(ll n) {
    ll res = 1;
    for(ll i=2;i<=n;i++) {
        res*=i;
    }
    return res;
}

ll _lcm(ll x,ll y) {
    return x*y/__gcd(x,y);
}

ll _gcd(ll a,ll b) {
    return a%b==0 ? b : _gcd(b,a%b);
}

ll nCr(ll n,ll r) {
    return (ld)fact(n)/(ld)(fact(r)*fact(n-r));
}

bool isCoPrime(ll z,ll a[],ll n) {
    for(ll i=0;i<n;i++) {
        if(_gcd(a[i],z)==1) {
            return 1;
        }
    }
    return 0;
}

ll solve(ll prm[15],ll i,ll res,ll a[],ll n) {
    if(i==15) {
        if(!isCoPrime(res,a,n)) {
            return res;
        }else {
            return 1e18;
        }
    }
    return min(solve(prm,i+1,res*prm[i],a,n),solve(prm,i+1,res,a,n));
}

int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //Sieve(1000000);
    ll prm[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++) {
        cin>>a[i];
    }
    cout<<solve(prm,0,1,a,n);
    return 0;
}
