#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1000000000000000000

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int tt=1;
	//cin >> tt;
	while(tt--)
	{
		int n;
		cin >> n;
		int a[n],b[n];
		for(int i=0;i<n;i++)
			cin >> a[i];
		for(int i=0;i<n;i++)
			cin >> b[i];
		pair<int,int> odd[n/2], even[n/2];
		for(int i=0;i<n;i++)
		{
			if(i%2==0)
				even[i/2]={a[i]-b[i],i};
			else
				odd[i/2]={a[i]-b[i],i};
		}
		sort(even,even+n/2);
		sort(odd,odd+n/2);
		int ans=0;
		for(int i=n/2-1;i>=0;i--)
		{
			if(even[i].first+odd[i].first>=0)
			{
				ans+=a[even[i].second]+a[odd[i].second];
			}
			else
			{
				ans+=b[even[i].second]+b[odd[i].second];
			}
		}
		cout << ans << endl;
	}
	return 0;
}
#include <iostream>
#include <stdio.h>
#include <vector>
#include <list>
#include <algorithm>
#include <string.h>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
    int n;
    cin >> n;
    vector<long long> a(n);
    long long cu = 0;
    for (int i = 0; i < n; i++)
    {
        //  行かなきゃ-A,行けば+A+B
        //  行くと+2A+B
        long long x, y;
        cin >> x >> y;
        a[i] = 2 * x + y;
        cu -= x;
    }
    sort(a.begin(), a.end());

    for (int i = n - 1; i >= 0; i--)
    {
        cu += a[i];
        if (cu > 0)
        {
            printf("%d", n - i);
            return 0;
        }
    }
    return 0;
}