#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define bg begin()
#define en end()
#define endl "\n"
#define vvl(n,m) vector<vector<ll> > a( n , vector<ll> (m))
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
using namespace std;
ll gcd(ll a,ll b){
    if(a==0)
        return b;
    else return gcd(b%a,a);
}
ll power(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y / 2, m) % m; 
    p = (p * p) % m; 
  
    return (y % 2 == 0) ? p : (x * p) % m; 
} 
ll modInverse(ll a, ll m) 
{ 
    return power(a, m - 2, m); 
}
ll ncr(ll n, ll k) 
{ 
    ll res = 1; 
  
    if (k > n - k) 
        k = n - k; 
    for (ll i = 0; i < k; ++i) { 
        res *= (n - i); 
        res /= (i + 1); 
    } 
  
    return res; 
} 
void permute(string str)
{
    set<string> s;
    sort(str.begin(), str.end());
    do {
        if(s.count(str)==0)
        cout << str << endl;
        s.insert(str);
    } while (next_permutation(str.begin(), str.end()));
}
void solve()
{
    ll n,i,j;
    cin>>n;
    ll x[n],y[n];
    for(i=0;i<n;i++){
        cin>>x[i]>>y[i];
    }
    ll ans=0;
    for(i=0;i<n-1;i++){
        for(j=i+1;j<n;j++){
            if(abs(x[j]-x[i])>=abs(y[j]-y[i]))
                ans++;
        }
    }
    cout<<ans;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast
    solve();
    #ifndef ONLINE_JUDGE
    cout << "\nTime Elapsed: " << 1.0 * clock()  / CLOCKS_PER_SEC << " sec\n";
    #endif
    return 0;
}
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <functional>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecvec vector<vec>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}


/*
string x="atcoder";

int func(string s){
    if(s.length()>x.length()){
        bool flag=true;
        rep(i,x.length())if(s[i]!=x[i])flag=false;
        if(flag)return 0;
    }
    rep(i,s.length())if(s[i]!='a')return i;
    return -1;
}

int main(){
    int n=in();
    rep(i,n)cout<<func(stin())<<endl;
}
*/
int main(){
    int n=in();
    ll ans=0;
    vecll a(n),b(n);
    rep(i,n)a[i]=in();
    rep(i,n)b[i]=in();
    vecll odd,even;
    rep(i,n){
        ans += a[i];
        if(i%2==0){
            even.pb(b[i]-a[i]);
        }else{
            odd.pb(b[i]-a[i]);
        }
    }
    sort(ALL(odd),greater<ll>());
    sort(ALL(even),greater<ll>());
    vecll sumO(n/2+1),sumE(n/2+1);
    rep(i,n/2){
        sumO[i+1]=sumO[i]+odd[i];
        sumE[i+1]=sumE[i]+even[i];
    }
    ll tmp=LONG_MIN;
    rep(i,n/2+1)tmp=max(tmp,sumO[i]+sumE[i]);
    cout<<ans+tmp<<endl;
}
