/*
Author- Aasav Badera
Time- Fri May  1 18:55:19 2020
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define ll                 long long
#define vi                 vector<ll >
// -------------------Standard Traversal Moves---------------------
// vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1};
// vi fx = {2, -2, 2, -2,  1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2};
// vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1};
// ----------------------------------------------------------------

#define int                long long
#define pb                 push_back
#define mii                map<ll ,ll >
#define rep(i, a, b)       for(ll  i=a;i<b;i++)
#ifdef LOCAL
#define dbg(args...)       { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
#define dbg(args...)
#endif
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define hell               1000000007
// #define hell               (ll)998244353
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define mp                 make_pair
#define yes                cout << "YES" << endl
#define no                 cout << "NO" << endl
#define inf                9223372036854775807
#define endl               '\n'
#define N                  100005
ll n, m, k, cnt[N];
si s;
vi v[N];
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    ll tests = 1;
    // cin >> tests;
    rep(test, 1, tests+1)
    {
        cin >> n;
        int num[n];
        int vis[n];
        rep( i,0 ,n){
        	cin >> num[i];
        	s.insert(num[i]);
        	vis[i] = 0;
        }
        sort(num, num + n);
        rep( i,0 ,n)
        	v[num[i]].pb(i);
        int ans = 0;
        for(int i = n - 1; i > -1 ;i--)
        {
        	if(!vis[i])
        	{
        		auto idx = lower_bound(all(s), num[i]/2);
        		if(*idx != num[i]/2){

	        		if(idx == s.begin())
	        		{
	        			vis[i] = 1;
	        			ans++;
	        			continue;
	        		}
        			idx--;
        		}
        		vis[v[*idx][sz(v[*idx]) - 1]] = 1;
        		vis[i] = 1;
        		ans++;
        		v[*idx].pop_back();
                if(!sz(v[*idx]))s.erase(*idx);
        	}
        }
        cout << ans << endl;
    }
    return 0;
}


/*
Author- Aasav Badera
Time- Fri May  1 18:55:19 2020
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define ll                 long long
#define vi                 vector<ll >
// -------------------Standard Traversal Moves---------------------
// vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1};
// vi fx = {2, -2, 2, -2,  1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2};
// vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1};
// ----------------------------------------------------------------

#define int                long long
#define pb                 push_back
#define mii                map<ll ,ll >
#define rep(i, a, b)       for(ll  i=a;i<b;i++)
#ifdef LOCAL
#define dbg(args...)       { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
#define dbg(args...)
#endif
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define hell               1000000007
// #define hell               (ll)998244353
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define mp                 make_pair
#define yes                cout << "YES" << endl
#define no                 cout << "NO" << endl
#define inf                9223372036854775807
#define endl               '\n'
#define N                  100005
ll n, m, k, cnt[N];
si s;
vi v[N];
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    ll tests = 1;
    // cin >> tests;
    rep(test, 1, tests+1)
    {
        cin >> n;
        int num[n];
        int vis[n];
        rep( i,0 ,n){
        	cin >> num[i];
        	s.insert(num[i]);
        	vis[i] = 0;
        }
        sort(num, num + n);
        rep( i,0 ,n)
        	v[num[i]].pb(i);
        int ans = 0;
        for(int i = n - 1; i > -1 ;i--)
        {
        	if(!vis[i])
        	{
        		auto idx = lower_bound(all(s), num[i]/2);
        		if(*idx != num[i]/2){

	        		if(idx == s.begin())
	        		{
	        			vis[i] = 1;
	        			ans++;
	        			continue;
	        		}
        			idx--;
        		}
        		vis[v[*idx][sz(v[*idx]) - 1]] = 1;
        		vis[i] = 1;
        		ans++;
        		v[*idx].pop_back();
        	}
        }
        cout << ans << endl;
    }
    return 0;
}


/*
Author- Aasav Badera
Time- Sun May  3 06:10:39 2020
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define ll                 long long
#define vi                 vector<ll >
// -------------------Standard Traversal Moves---------------------
// vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1};
// vi fx = {2, -2, 2, -2,  1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2};
// vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1};
// ----------------------------------------------------------------

#define int                long long
#define pb                 push_back
#define mii                map<ll ,ll >
#define rep(i, a, b)       for(ll  i=a;i<b;i++)
#ifdef LOCAL
#define dbg(args...)       { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
#define dbg(args...)
#endif
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define hell               1000000007
// #define hell               (ll)998244353
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define mp                 make_pair
#define yes                cout << "YES" << endl
#define no                 cout << "NO" << endl
#define inf                9223372036854775807
#define endl               '\n'
#define N                  200005
ll n, m, k, a[N];

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    ll tests = 1;
    // cin >> tests;
    rep(test, 1, tests+1)
    {
        cin >> n;
        rep( i,0, n)
            cin >> a[i];
        sort(a, a + n);
        int ans = 0;
        ll ptr1 = n - 1, ptr2 = (n-1)/2;
        while(ptr1 > (n-1)/2 and ptr2 > -1)
        {
            if(a[ptr1] >= 2*a[ptr2])
            {
                ans++;
                ptr1--;
                ptr2--;
            }
            else{
                ans++;
                ptr2--;
            }
        }
        while(ptr2 > -1)
        {
            ans++;
            ptr2--;
        }
        while(ptr1 > (n - 1) / 2)
        {
            ans++;
            ptr1--;
        }
        cout << ans << endl;
    }
    return 0;
}


/*
Author- Aasav Badera
Time- Sun May  3 06:10:39 2020
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define ll                 long long
#define vi                 vector<ll >
// -------------------Standard Traversal Moves---------------------
// vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1};
// vi fx = {2, -2, 2, -2,  1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2};
// vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1};
// ----------------------------------------------------------------

#define int                long long
#define pb                 push_back
#define mii                map<ll ,ll >
#define rep(i, a, b)       for(ll  i=a;i<b;i++)
#ifdef LOCAL
#define dbg(args...)       { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
#define dbg(args...)
#endif
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define hell               1000000007
// #define hell               (ll)998244353
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define mp                 make_pair
#define yes                cout << "YES" << endl
#define no                 cout << "NO" << endl
#define inf                9223372036854775807
#define endl               '\n'
#define N                  200005
ll n, m, k, a[N];

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    ll tests = 1;
    // cin >> tests;
    rep(test, 1, tests+1)
    {
        cin >> n;
        rep( i,0, n)
            cin >> a[i];
        sort(a, a + n);
        int ans = 0;
        ll ptr1 = n - 1, ptr2 = (n-2)/2;
        while(ptr1 > (n-1)/2 and ptr2 > -1)
        {
            if(a[ptr1] >= 2*a[ptr2])
            {
                ans++;
                ptr1--;
                ptr2--;
            }
            else{
                ans++;
                ptr2--;
            }
        }
        while(ptr2 > -1)
        {
            ans++;
            ptr2--;
        }
        while(ptr1 > (n - 1) / 2)
        {
            ans++;
            ptr1--;
        }
        cout << ans << endl;
    }
    return 0;
}


/*
Author- Aasav Badera
Time- Sun May  3 06:10:39 2020
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define ll                 long long
#define vi                 vector<ll >
// -------------------Standard Traversal Moves---------------------
// vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1};
// vi fx = {2, -2, 2, -2,  1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2};
// vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1};
// ----------------------------------------------------------------

#define int                long long
#define pb                 push_back
#define mii                map<ll ,ll >
#define rep(i, a, b)       for(ll  i=a;i<b;i++)
#ifdef LOCAL
#define dbg(args...)       { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
#define dbg(args...)
#endif
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define hell               1000000007
// #define hell               (ll)998244353
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define mp                 make_pair
#define yes                cout << "YES" << endl
#define no                 cout << "NO" << endl
#define inf                9223372036854775807
#define endl               '\n'
#define N                  200005
ll n, m, k, a[N];

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    ll tests = 1;
    // cin >> tests;
    rep(test, 1, tests+1)
    {
        cin >> n;
        rep( i,0, n)
            cin >> a[i];
        sort(a, a + n);
        int ans = 0;
        ll ptr1 = n - 1, ptr2 = (n-2)/2;
        while(ptr1 > (n-2)/2 and ptr2 > -1)
        {
            if(a[ptr1] >= 2*a[ptr2])
            {
                ans++;
                ptr1--;
                ptr2--;
            }
            else{
                ans++;
                ptr2--;
            }
        }
        while(ptr2 > -1)
        {
            ans++;
            ptr2--;
        }
        while(ptr1 > (n - 2) / 2)
        {
            ans++;
            ptr1--;
        }
        cout << ans << endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a)
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
#define ll long long int

#define DEBUG

#ifdef DEBUG

    #define debug(args...)(Debugger()) , args

    class Debugger{
        public:
        Debugger(const std::string& _separator = " | ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << std::endl;}

        private:

        bool first;
        std::string separator;
    };

#else
    #define debug(args...)
#endif

void solve(){

	int n;
	cin >> n;
	vector <int> a(n);

	for(int i = 0; i < n; ++i)
		cin >> a[i];

	sort(ALL(a));

	int l = 0, r = n-1;
	int ans = 0;
	while(l <= r){

		int mid = l +((r-l)>>1);
		bool flag = (mid <= (n-1-mid) and a[n-1] >= 2*a[mid] and a[n-1-mid] >= 2*a[0]);
		// debug(l, r, mid, flag);

		if(flag){
			ans = mid+1;
			l = mid+1;
		}else{
			r = mid - 1;
		}
	}
	cout << n-ans << "\n";
}

int main(){

	boost;

	int T;

	// cin >> T;
	T = 1;

	while(T--){
		solve();
	}
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a)
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
#define ll long long int

#define DEBUG

#ifdef DEBUG

    #define debug(args...)(Debugger()) , args

    class Debugger{
        public:
        Debugger(const std::string& _separator = " | ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << std::endl;}

        private:

        bool first;
        std::string separator;
    };

#else
    #define debug(args...)
#endif

void solve(){

	int n;
	cin >> n;
	vector <int> a(n);

	for(int i = 0; i < n; ++i)
		cin >> a[i];

	sort(ALL(a));

	int l = 0, r = n-1;
	int ans = 0;
	while(l <= r){

		int mid = l +((r-l)>>1);
		bool flag = (mid < (n-1-mid) and a[n-1] > 2*a[mid] and a[n-1-mid] > 2*a[0]);
		// debug(l, r, mid, flag);

		if(flag){
			ans = mid+1;
			l = mid+1;
		}else{
			r = mid - 1;
		}
	}
	cout << n-ans << "\n";
}

int main(){

	boost;

	int T;

	// cin >> T;
	T = 1;

	while(T--){
		solve();
	}
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a)
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
#define ll long long int

#define DEBUG

#ifdef DEBUG

    #define debug(args...)(Debugger()) , args

    class Debugger{
        public:
        Debugger(const std::string& _separator = " | ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << std::endl;}

        private:

        bool first;
        std::string separator;
    };

#else
    #define debug(args...)
#endif

void solve(){

	int n;
	cin >> n;
	vector <int> a(n);

	for(int i = 0; i < n; ++i)
		cin >> a[i];

	sort(ALL(a));

	int l = 0, r = n-1;
	int ans = 0;
	while(l <= r){

		int mid = l +((r-l)>>1);
		bool flag = (mid < (n-1-mid) and a[n-1] >= 2*a[mid] and a[n-1-mid] >= 2*a[0]);
		// debug(l, r, mid, flag);

		if(flag){
			ans = mid+1;
			l = mid+1;
		}else{
			r = mid - 1;
		}
	}
	cout << n-ans << "\n";
}

int main(){

	boost;

	int T;

	// cin >> T;
	T = 1;

	while(T--){
		solve();
	}
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a)
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
#define ll long long int

#define DEBUG

#ifdef DEBUG

    #define debug(args...)(Debugger()) , args

    class Debugger{
        public:
        Debugger(const std::string& _separator = " | ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << std::endl;}

        private:

        bool first;
        std::string separator;
    };

#else
    #define debug(args...)
#endif

void solve(){

	int n;
	cin >> n;
	vector <int> a(n);

	for(int i = 0; i < n; ++i)
		cin >> a[i];

	sort(ALL(a));

	int l = 0, r = (n >> 1) - ((n&1) == 0);
	int ans = 0;
	while(l <= r){

		int mid = l +((r-l)>>1);
		bool flag = a[n-1] >= 2*a[mid] and a[n-1-mid] >= 2*a[0];
		// debug(l, r, mid, flag);

		if(flag){
			ans = mid+1;
			l = mid+1;
		}else{
			r = mid - 1;
		}
	}
	cout << n-ans << "\n";
}

int main(){

	boost;

	int T;

	// cin >> T;
	T = 1;

	while(T--){
		solve();
	}
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a)
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
#define ll long long int

#define DEBUG

#ifdef DEBUG

    #define debug(args...)(Debugger()) , args

    class Debugger{
        public:
        Debugger(const std::string& _separator = " | ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << std::endl;}

        private:

        bool first;
        std::string separator;
    };

#else
    #define debug(args...)
#endif

void solve(){

	int n;
	cin >> n;
	vector <int> a(n);

	for(int i = 0; i < n; ++i)
		cin >> a[i];

	sort(ALL(a));

	int l = 0, r = n >> 1;
	int ans = 0;
	while(l <= r){

		int mid = l +((r-l)>>1);
		bool flag = a[n-1] >= 2*a[mid-1] and a[n-mid] >= 2*a[0];
		debug(l, r, mid, flag);

		if(flag){
			ans = mid;
			l = mid+1;
		}else{
			r = mid - 1;
		}
	}
	cout << n-ans << "\n";
}

int main(){

	boost;

	int T;

	// cin >> T;
	T = 1;

	while(T--){
		solve();
	}
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a)
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
#define ll long long int

#define DEBUG

#ifdef DEBUG

    #define debug(args...)(Debugger()) , args

    class Debugger{
        public:
        Debugger(const std::string& _separator = " | ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << std::endl;}

        private:

        bool first;
        std::string separator;
    };

#else
    #define debug(args...)
#endif
const int N = 500010;
int a[N];
int n;

int check(int mid){
	return a[0]*2 <= a[n-mid] and a[mid-1]*2 <= a[n-1];
}

void solve(){
	cin >> n;
	for(int i = 0; i < n; ++ i) cin >> a[i];
	sort(a, a + n);
	int l = 0, r = n / 2;
	while(l < r){
		int mid = l + r + 1 >> 1;
		if(check(mid)) l = mid;
		else r = mid - 1;
	}
	cout << n - l << '\n';
}

int main(){

	boost;

	int T;

	// cin >> T;
	T = 1;

	while(T--){
		solve();
	}
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a)
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
#define ll long long int

#define DEBUG

#ifdef DEBUG

    #define debug(args...)(Debugger()) , args

    class Debugger{
        public:
        Debugger(const std::string& _separator = " | ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << std::endl;}

        private:

        bool first;
        std::string separator;
    };

#else
    #define debug(args...)
#endif

void solve(){

	int n;
	cin >> n;
	vector <int> a(n);

	for(int i = 0; i < n; ++i)
		cin >> a[i];

	sort(ALL(a));

	int l = 0, r = n-1;
	int ans = 0;
	while(l <= r){

		int mid = l +((r-l)>>1);
		bool flag = (mid <= (n-1-mid) and a[n-1] > 2*a[mid] and a[n-1-mid] > 2*a[0]);
		// debug(l, r, mid, flag);

		if(flag){
			ans = mid+1;
			l = mid+1;
		}else{
			r = mid - 1;
		}
	}
	cout << n-ans << "\n";
}

int main(){

	boost;

	int T;

	// cin >> T;
	T = 1;

	while(T--){
		solve();
	}
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a)
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
#define ll long long int

#define DEBUG

#ifdef DEBUG

    #define debug(args...)(Debugger()) , args

    class Debugger{
        public:
        Debugger(const std::string& _separator = " | ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << std::endl;}

        private:

        bool first;
        std::string separator;
    };

#else
    #define debug(args...)
#endif
const int N = 500010;
int a[N];
int n;

int check(int mid){
	// return !(a[0]*2 > a[n-mid] or a[mid-1]*2 > a[n-1]);
	for(int i = 0; i < mid; ++ i){
		if(a[i] * 2 > a[n - mid + i]) return false;
	}
	return true;
}

void solve(){
	cin >> n;
	for(int i = 0; i < n; ++ i) cin >> a[i];
	sort(a, a + n);
	int l = 0, r = n / 2;
	while(l < r){
		int mid = l + r + 1 >> 1;
		if(check(mid)) l = mid;
		else r = mid - 1;
	}
	cout << n - l << '\n';
}

int main(){

	boost;

	int T;

	// cin >> T;
	T = 1;

	while(T--){
		solve();
	}
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a)
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
#define ll long long int

#define DEBUG

#ifdef DEBUG

    #define debug(args...)(Debugger()) , args

    class Debugger{
        public:
        Debugger(const std::string& _separator = " | ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << std::endl;}

        private:

        bool first;
        std::string separator;
    };

#else
    #define debug(args...)
#endif

void solve(){

	int n;
	cin >> n;
	vector <int> a(n);

	for(int i = 0; i < n; ++i)
		cin >> a[i];

	sort(ALL(a));

	int l = 0, r = (n - 1 - (n&1)) >> 1	;
	int ans = 0;
	while(l <= r){

		int mid = l +((r-l)>>1);
		bool flag = a[n-1] >= 2*a[mid] and a[n-1-mid] >= 2*a[0];
		// debug(l, r, mid, flag);

		if(flag){
			ans = mid+1;
			l = mid+1;
		}else{
			r = mid - 1;
		}
	}
	cout << n-ans << "\n";
}

int main(){

	boost;

	int T;

	// cin >> T;
	T = 1;

	while(T--){
		solve();
	}
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    const int m=1e5;
    vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
    vector<int> data(m+1,0);
    for(int i=0;i<n;i++){
        data[v[i]]++;
    }
    int points=0;
    int j;
    // int x=m;
    for(int i=m;i>=2;i--){
        // if(i/2<x)
        j=i/2;
        while(data[i]>0&&j>=1){
            if(data[j]>=data[i]&&data[i]>0&&data[j]>0){
                points+=data[i];data[j]-=data[i];data[i]=0;i--;
                // if(j>i/2)
                j=i/2;
            }
            else if(data[j]>0&&data[i]>0){
                points+=data[j];data[i]-=data[j];data[j]=0;j--;
            }
            else{
                j--;
            }
            // x=j;
        }
    }
    // cout<<points<<endl;
    cout<<points+accumulate(data.begin(),data.end(),0);

}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    const int m=1e5;
    vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
    vector<int> data(m+1,0);
    for(int i=0;i<n;i++){
        data[v[i]]++;
    }
    int points=0;
    int j;
    int x=m;
    for(int i=m;i>=2;i--){
        // if(i/2<x)
        j=i/2;
        while(data[i]>0&&j>=1){
            if(data[j]>=data[i]&&data[i]>0&&data[j]>0){
                points+=data[i];data[j]-=data[i];data[i]=0;
                // if(j>i/2)j=i/2;
            }
            else if(data[j]>0&&data[i]>0){
                points+=data[j];data[i]-=data[j];data[j]=0;j--;
            }
            else{
                j--;
            }
            // x=j;
        }
    }
    // cout<<points<<endl;
    cout<<points+accumulate(data.begin(),data.end(),0);

}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
    sort(v.begin(),v.end());
    int count=0;
    // int m=n/2;
    int j=n/2;
    for(int i=0;i<n/2;i++){
        if(v[i]==0)continue;
        for(j=j;j<n;j++){
            if(v[j]/2>=v[i]&&v[j]!=0){
                v[i]=0;v[j]=0;count++;break;
            }
        }
    }
    for(int i=0;i<n;i++){
        if(v[i]!=0)count++;
    }
    cout<<count<<endl;

}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    const int m=1e5;
    vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
    vector<int> data(m+1,0);
    for(int i=0;i<n;i++){
        data[v[i]]++;
    }
    int points=0;
    int j;
    int x=m;
    for(int i=m;i>=2;i--){
        if(i/2<x)
        j=i/2;
        while(data[i]>0&&j>=1){
            if(data[j]>=data[i]&&data[i]>0&&data[j]>0){
                points+=data[i];data[j]-=data[i];data[i]=0;i--;
                if(j>i/2)j=i/2;
            }
            else if(data[j]>0&&data[i]>0){
                points+=data[j];data[i]-=data[j];data[j]=0;j--;
            }
            else{
                j--;
            }
            x=j;
        }
    }
    // cout<<points<<endl;
    cout<<points+accumulate(data.begin(),data.end(),0);

}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    const int m=1e5;
    vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
    vector<int> data(m+1,0);
    for(int i=0;i<n;i++){
        data[v[i]]++;
    }
    int points=0;
    int j;
    int x=m;
    for(int i=m;i>=2;i--){
        // if(i/2<x)
        j=i/2;
        while(data[i]>0&&j>=1){
            if(data[j]>=data[i]){
                points+=data[i];data[j]-=data[i];data[i]=0;
                // if(j>i/2)j=i/2;
            }
            else{
                points+=data[j];data[i]-=data[j];data[j]=0;j--;
            }
            // x=j;
        }
    }
    // cout<<points<<endl;
    cout<<points+accumulate(data.begin(),data.end(),0);

}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
    sort(v.begin(),v.end());
    int count=0;int j=n-1;
    for(int i=n-1;i>=0;i--){
        if(v[i]==0)continue;
        for(j=j;j>=0;j--){
            if(v[i]/2>=v[j]&&v[j]!=0){
                count++;v[i]=0;v[j]=0;break;
            }
        }
        if(j==0)break;
    }
    for(int i=0;i<n;i++){
        if(v[i]!=0)count++;
    }
    cout<<count<<endl;

}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
    sort(v.begin(),v.end());
    int count=0;int j=n-1;
    for(int i=n-1;i>=0;i--){
        if(v[i]==0)continue;
        for(j=j;j>=0;j--){
            if(v[i]/2>=v[j]){
                count++;v[i]=0;v[j]=0;j--;break;
            }
        }
    }
    for(int i=0;i<n;i++){
        if(v[i]!=0)count++;
    }
    cout<<count<<endl;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n , index;
    bool test = false;
     cin>>n;
     int arr[n];
     for(int i=0 ; i< n ; i++)
     cin>>arr[i];
     sort(arr,arr+n);
     for(int i=n/2 ; i>0 ; i--)
     {
         for(int j=(n/2)+1 ; j < n ; j++)
         {
             if(arr[i]*2 <= arr[j])
             {
                 index=i;
                 test=true ;
                 break;
             }
         }
         if(test)
            break;
     }
     cout<<n-index-1;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
 {
    int n ,temp ,j, k ,temp1;
    bool test = false;
     cin>>n;
     temp=n;
     int arr[n];
     for(int i=0 ; i< n ; i++)
     cin>>arr[i];
     sort(arr,arr+n);
     (n%2==0) ? temp1=n/2 : temp1=(n/2)-1;
     for( k=0 ,j=temp1; k<n/2,j < n  ;  j++)
     {
             if(arr[k]*2 <= arr[j])
             {
                 k++;
                temp--;
             }
     }
        cout<<temp;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n ,temp;
    bool test = false;
     cin>>n;
     temp=n;
     int arr[n];
     for(int i=0 ; i< n ; i++)
     cin>>arr[i];
     sort(arr,arr+n);
     for(int i=0 ,j=(n/2); i<n/2,j < n  ;  j++)
     {

             if(arr[i]*2 <= arr[j])
             {
                 i++;
                temp--;
             }

     }
     if(n%2==0)
     cout<<temp;
     else
        cout<<temp+1;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n , index;
    bool test = false;
     cin>>n;
     int arr[n];
     for(int i=0 ; i< n ; i++)
     cin>>arr[i];
     sort(arr,arr+n);
     for(int i=n/2 ; i>=0 ; i--)
     {
         for(int j=(n/2)+1; j < n ; j++)
         {
             if(arr[i]*2 <= arr[j])
             {
                 index=i;
                 test=true ;
                 break;
             }
         }
         if(test)
            break;
     }
     if(index==n/2)
        cout<<index;
     else
     cout<<n-index-1;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n , index;
    bool test = false;
     cin>>n;
     int arr[n];
     for(int i=0 ; i< n ; i++)
     cin>>arr[i];
     sort(arr,arr+n);

     for(int i=n/2 ; i>=0 ; i--)
     {
         for(int j=(n/2)+1; j < n ; j++)
         {

             if(arr[i]*2 <= arr[j])
             {
                if(! arr[i]!=arr[i-1])
                 index=i;
                 test=true ;
                 break;
             }
         }
         if(test)
            break;
     }
     if(index==n/2)
        cout<<index;
     else
     cout<<n-index-1;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n ,temp;
    bool test = false;
     cin>>n;
     temp=n;
     int arr[n];
     for(int i=0 ; i< n ; i++)
     cin>>arr[i];
     sort(arr,arr+n);
     for(int i=0 ,j=(n/2); i<n/2,j < n  ;  j++)
     {

             if(arr[i]*2 <= arr[j])
             {
                 i++;
                temp--;
             }

     }

     if(n%2!=0 && temp== n/2)
     cout<<temp+1;
     else
        cout<<temp;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n ,temp ,j, k ;
    bool test = false;
     cin>>n;
     temp=n;
     int arr[n];
     for(int i=0 ; i< n ; i++)
     cin>>arr[i];
     sort(arr,arr+n);
     for( k=0 ,j=(n/2); k<n/2,j < n  ;  j++)
     {

             if(arr[k]*2 <= arr[j])
             {
                 k++;
                temp--;
             }

     }
     if(n%2!=0 && k==n/2 )
     cout<<temp+1;
     else
        cout<<temp;
    return 0;
}


#define ll long long
#define pii pair<ll,ll>
#define m_p  make_pair
#define ull unsigned long long
#define spd  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
int main()
{
  spd;

  ll n,i,a,cnt=0,idx,mn,j,add=0;
  cin>>n;
  mn = n+1;
  vector<ll>v(n);

  for(i=0;i<n;i++)
  {
      cin>>v[i];
  }
  sort(v.begin(),v.end());
  map<ll,ll>mp;
  i=0;
  j = n/2;

  while(i<n/2&&j<n)
  {
      if(v[i]*2<=v[j])
      {
          mp[i]=1;
          i++;
          j++;
      }

      else
      {
        j++;
      }
  }

  for(i=0;i<n/2;i++)
  {
      if(!mp[i])add++;
  }
  cout<<(n/2+(n%2))+add<<endl;
}


#define ll long long
#define pii pair<ll,ll>
#define m_p  make_pair
#define ull unsigned long long
#define spd  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
int main()
{
  spd;

  ll n,i,a,cnt=0,idx,mn,j,add=0;
  cin>>n;
  mn = n+1;
  vector<ll>v(n);

  for(i=0;i<n;i++)
  {
      cin>>v[i];
  }
  sort(v.begin(),v.end());
  i=0;
  j = n/2;

  while(i<n/2&&j<=n)
  {
      if(v[i]*2<=v[j])
      {
          i++;
          j++;
      }

      else
      {
          add++;
          j++;
      }
  }

  cout<<(n/2)+add<<endl;
}


#define ll long long
#define pii pair<ll,ll>
#define m_p  make_pair
#define ull unsigned long long
#define spd  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
int main()
{
  spd;

  ll n,i,a,range,cnt=0,idx,mn;
  cin>>n;
  mn = n+1;
  vector<ll>v(n);

  for(i=0;i<n;i++)
  {
      cin>>v[i];
  }

  sort(v.begin(),v.end());

  for(i=0;i<n;i++)
  {
      idx = lower_bound(v.begin(),v.end(),v[i]*2) - v.begin();

      if(idx==n)
      {
          cout<<n-i<<endl;
          return 0;
      }

      mn = min(mn,idx);

      ll add = 0;
      if(i>=mn)add = 1;

      if(n-(mn+cnt+add)>0)
      {
          cnt++;
      }

      else
      {
          cout<<n-i<<endl;
          return 0;
      }
  }
}


#define ll long long
#define pii pair<ll,ll>
#define m_p  make_pair
#define ull unsigned long long
#define spd  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
int main()
{
  spd;

  ll n,i,a,cnt=0,idx,mn,j,add=0;
  cin>>n;
  mn = n+1;
  vector<ll>v(n);

  for(i=0;i<n;i++)
  {
      cin>>v[i];
  }
  sort(v.begin(),v.end());
  i=0;
  j = n/2;

  while(i<n/2&&j<n)
  {
      if(v[i]*2<=v[j])
      {
          i++;
          j++;
      }

      else
      {
          add++;
          j++;
      }
  }

  cout<<(n/2)+add<<endl;
}


#define ll long long
#define pii pair<ll,ll>
#define m_p  make_pair
#define ull unsigned long long
#define spd  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
int main()
{
  spd;

  ll n,i,a,range,cnt=0,idx,mn;
  cin>>n;
  mn = n+1;
  vector<ll>v(n);

  for(i=0;i<n;i++)
  {
      cin>>v[i];
  }

  sort(v.begin(),v.end());

  for(i=0;i<n;i++)
  {
      idx = lower_bound(v.begin(),v.end(),v[i]*2) - v.begin();

      if(idx==n)
      {
          cout<<n-i<<endl;
          return 0;
      }

      mn = min(mn,idx);

      if(n-mn+cnt>0)
      {
          cnt++;
      }

      else
      {
          cout<<n-i<<endl;
          return 0;
      }
  }
}


#define ll long long
#define pii pair<ll,ll>
#define m_p  make_pair
#define ull unsigned long long
#define spd  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
int main()
{
  spd;

  ll n,i,a,range,cnt=0,idx,mn;
  cin>>n;
  mn = n+1;
  vector<ll>v(n);

  for(i=0;i<n;i++)
  {
      cin>>v[i];
  }
  map<ll,ll>mp;
  sort(v.begin(),v.end());

  for(i=0;i<n;i++)
  {
      idx = lower_bound(v.begin(),v.end(),v[i]*2) - v.begin();

      mp[idx]++;
  }

  for(i=0;i<n-1;i++)
  {
      if(mp[i]>1)
      {
          mp[i+1]+=mp[i]-1;
          mp[i] = 1;
      }
  }

  for(i=0;i<n;i++)
  {
      idx = lower_bound(v.begin(),v.end(),v[i]*2) - v.begin();
      if(idx==n)
      {
          cout<<n-i<<endl;
          return 0;
      }
      if((n-(idx+cnt))<=0)
      {
          cout<<n-i<<endl;
          return 0;
      }

      if(mp[i])cnt++;
  }

}


#define ll long long
#define pii pair<ll,ll>
#define m_p  make_pair
#define ull unsigned long long
#define spd  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
int main()
{
  spd;

  ll n,i,a,cnt=0,idx,mn,j,add=0;
  cin>>n;
  mn = n+1;
  vector<ll>v(n);

  for(i=0;i<n;i++)
  {
      cin>>v[i];
  }
  sort(v.begin(),v.end());
  i=0;
  j = n/2;

  while(i<n/2&&j<n)
  {
      if(v[i]*2<=v[j])
      {
          i++;
          j++;
      }

      else
      {
          add++;
          j++;
      }
  }
  if(n%2)add++;
  cout<<(n/2)+add<<endl;
}


#define ll long long
#define pii pair<ll,ll>
#define m_p  make_pair
#define ull unsigned long long
#define spd  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
int main()
{
  spd;

  ll n,i,a,range,cnt=0,idx,mn=n+1;
  cin>>n;

  vector<ll>v(n);

  for(i=0;i<n;i++)
  {
      cin>>v[i];
  }

  sort(v.begin(),v.end());

  for(i=0;i<n;i++)
  {
      idx = lower_bound(v.begin(),v.end(),v[i]*2) - v.begin();

      if(idx==n)
      {
          cout<<n-i<<endl;
          return 0;
      }

      mn = min(mn,idx);

      if(n-mn+cnt>0)
      {
          cnt++;
      }

      else
      {
          cout<<n-i<<endl;
          return 0;
      }
  }
}


#define ll long long
#define pii pair<ll,ll>
#define m_p  make_pair
#define ull unsigned long long
#define spd  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
int main()
{
  spd;

  ll n,i,a,cnt=0,idx,mn,j,add=0;
  cin>>n;
  mn = n+1;
  vector<ll>v(n);

  for(i=0;i<n;i++)
  {
      cin>>v[i];
  }
  sort(v.begin(),v.end());
  map<ll,ll>mp;
  i=0;
  j = n/2;

  while(i<n/2&&j<n)
  {
      if(v[i]*2<=v[j])
      {
          mp[i]=1;
          i++;
          j++;
      }

      else
      {
        j++;
      }
  }

  for(i=0;i<n/2;i++)
  {
      if(!mp[i])add++;
  }
  cout<<(n/2)+add<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d", &n);
	int arr[n];
	for(int i=0; i<n; i++)
	{
		scanf("%d", &arr[i]);
	}
	sort(arr, arr+n);
	int sum = n;
	for(int i=0; i<n; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			if(arr[j] >= 2*arr[i])
			{
				sum -= 1;
				break;

			}
		}
	}
	printf("%d", sum);
}


///====================== TEMPLATE STARTS HERE =====================///
//#include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<deque>
#include<functional>
#include<string>
#include<iostream>
#include<cctype>
#include<set>
#include<climits>
#include<iomanip>
#include<cassert>
#include<sstream>
//#include<unordered_map>
const int inf = 1000000007;
const double pi = 2 * acos ( 0.0 );
typedef long long ll;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define maximum(v) *max_element(v.begin(), v.end())
#define minimum(v) *min_element(v.begin(), v.end())
#define MEMSET(v) memset(v, 0, sizeof(v))
//int dx[] = {0, 1, 0, -1};
//int dy[] = {-1, 0, 1, 0};
using namespace std;

int gcd (int a, int b ) {
    a =  abs( a ); b = abs( b );
    while ( b ) { a = a % b; swap ( a, b ); } return a;
}
///====================== TEMPLATE ends HERE =====================///

int main(){
    int n;
    scanf("%d", &n);
    int arr[n];
    for(int i=0; i<n; i++){
        scanf("%d", &arr[i]);
    }
    sort(arr, arr+n);
    bool mark[n];
    bool baccha[n];
    MEMSET(mark);
    int ans = n;
    int track=n/2, check = 0;
    for(int i=0; i<n/2; i++){
        for(;;){
            if(track > n-1){
                check = 1;
                break;
            }

            if(arr[track] >= arr[i]*2 and baccha[arr[track]] == false){
                baccha[track] = true;
                ans--;
                track++;
                break;
            }
            else{
                track++;
            }
        }
        if(check == 1){
            break;
        }
    }
    cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d", &n);
	int arr[n];
	for(int i=0; i<n; i++)
	{
		scanf("%d", &arr[i]);
	}
	sort(arr, arr+n);
	int sum = n;
	for(int i=0; i<n/2; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			if(arr[j] >= 2*arr[i])
			{
				sum -= 1;
				break;

			}
		}
	}
	printf("%d", sum);
}


import java.io.*;
import java.util.*;

public class CF {
    FastScanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        int[] b = new int[m];
        for (int i = 0; i < m; i++) {
            b[i] = in.nextInt();
            if (b[i] < a[a.length - 1]) {
                out.println(-1);
                return;
            }
        }
        long res = 0;
        for (int i = 0; i < n - 1; i++) {
            res += a[i] * 1L * m;
        }
        boolean hasMin = false;
        for (int i = 0; i < m; i++) {
            res += b[i];
            hasMin |= a[a.length - 1] == b[i];
        }
        if (!hasMin) {
            res += a[a.length - 1] - a[a.length - 2];
        }
        out.println(res);
    }

    void run() {
        try {
            in = new FastScanner(new File("CF.in"));
            out = new PrintWriter(new File("CF.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        new CF().runIO();
    }
}


import java.util.*;

public class TestClass {
    public static void main(String args[] ) throws Exception {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        int[] boy = new int[n];
        int[] girl  =new int[m];

        for(int i=0; i<n; i++)
        {
            boy[i] = sc.nextInt();
        }

        for(int i=0; i<m; i++)
        {
            girl[i] = sc.nextInt();
        }

        long sum=0;
        Arrays.sort(boy);
        Arrays.sort(girl);
        if(boy[n-1]>girl[0] || (n<2 && boy[0]!=girl[0]))
        {
             System.out.println("-1");
                    return;
        }
        for(int i =n-1; i>=0; i--)
        {
            for(int j=0; j<m && i>n-3; j++)
            {

                if(i==n-1)
                {
                    if(j==0)
                    {
                        sum+= boy[i];
                    }
                    else
                    {
                        sum+=girl[j];

                    }
                }
                else if(i==n-2 && j==0 && boy[n-1] != girl[0])
                {
                        sum+=girl[j];
                }
                else
                sum+= boy[i];
            }
            if(i<n-2)
            {sum += m*boy[i];}
        }
        System.out.println(sum);
        return;

    }
}


import java.util.*;

public class TestClass {
    public static void main(String args[] ) throws Exception {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        int[] boy = new int[n];
        int[] girl  =new int[m];
        long bsum=0,gsum=0;
        for(int i=0; i<n; i++)
        {
            boy[i] = sc.nextInt();
            bsum+=boy[i];
        }

        for(int i=0; i<m; i++)
        {
            girl[i] = sc.nextInt();
            gsum+=girl[i];
        }

        long sum=0;
        Arrays.sort(boy);
        Arrays.sort(girl);
        if(boy[n-1]>girl[0] )
        {
             System.out.println("-1");
                    return;
        }

       else
       {
           sum =sum + m*(bsum-boy[n-1]) + gsum;
           if(boy[n-1]<girl[0])
           {
               sum+= boy[n-1] -boy[n-1];
           }
           System.out.println(sum);
       }

    }
}


import java.util.*;

public class TestClass {
    public static void main(String args[] ) throws Exception {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        int[] boy = new int[n];
        int[] girl  =new int[m];

        for(int i=0; i<n; i++)
        {
            boy[i] = sc.nextInt();
        }

        for(int i=0; i<m; i++)
        {
            girl[i] = sc.nextInt();
        }

        int sum=0;
        for(int i =0; i<n; i++)
        {
            for(int j=0; j<m; j++)
            {
                if(boy[i]>girl[j])
                {
                    System.out.println("-1");
                    return;
                }
                if(i==0)
                {
                    if(j==0)
                    {
                        sum+= boy[i];
                    }
                    else
                    {
                        sum+=girl[j];

                    }
                }
                else if(i==1 && j==0 && boy[0] != girl[0])
                {
                        sum+=girl[j];
                }
                else
                sum+= boy[i];
            }
        }
        System.out.println(sum);
        return;

    }
}


import java.util.*;

public class TestClass {
    public static void main(String args[] ) throws Exception {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        int[] boy = new int[n];
        int[] girl  =new int[m];

        for(int i=0; i<n; i++)
        {
            boy[i] = sc.nextInt();
        }

        for(int i=0; i<m; i++)
        {
            girl[i] = sc.nextInt();
        }

        int sum=0;
        Arrays.sort(boy);
        Arrays.sort(girl);
        if(boy[n-1]>girl[0] || (n<2 && boy[0]!=girl[0]))
        {
             System.out.println("-1");
                    return;
        }
        for(int i =n-1; i>=0; i--)
        {
            for(int j=0; j<m && i>n-3; j++)
            {

                if(i==n-1)
                {
                    if(j==0)
                    {
                        sum+= boy[i];
                    }
                    else
                    {
                        sum+=girl[j];

                    }
                }
                else if(i==n-2 && j==0 && boy[n-1] != girl[0])
                {
                        sum+=girl[j];
                }
                else
                sum+= boy[i];
            }
            if(i<n-2)
            {sum += m*boy[i];}
        }
        System.out.println(sum);
        return;

    }
}


import java.util.*;

public class TestClass {
    public static void main(String args[] ) throws Exception {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        int[] boy = new int[n];
        int[] girl  =new int[m];
        long bsum=0,gsum=0;
        for(int i=0; i<n; i++)
        {
            boy[i] = sc.nextInt();
            bsum+=boy[i];
        }

        for(int i=0; i<m; i++)
        {
            girl[i] = sc.nextInt();
            gsum+=girl[i];
        }

        long sum=0;
        Arrays.sort(boy);
        Arrays.sort(girl);
        if(boy[n-1]>girl[0] )
        {
             System.out.println("-1");
                    return;
        }

       else
       {
           sum =sum + m*(bsum-boy[n-1]) + gsum;
           if(boy[n-1]<girl[0])
           {
               sum+= boy[n-1] -boy[n-2];
           }
           System.out.println(sum);
       }

    }
}


import java.util.Arrays;
import java.util.Scanner;

public class PartyAndSweets {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int M = in.nextInt();
        int[] boys = new int[N];
        int[] girls = new int[M];
        int sum = 0;
        int max = 0;
        for (int i = 0; i < N; i++) {
            boys[i] = in.nextInt();
            sum += M * boys[i];
            max = Math.max(boys[i], max);
        }
        for (int i  = 0; i < M; i++) {
            girls[i] = in.nextInt();
            if (girls[i] < max) {
                System.out.println(-1);
                System.exit(0);
            }
        }
        Arrays.sort(boys);
        Arrays.sort(girls);
        if (girls[0] == boys[N-1]) {
            sum += girls[0] - boys[N-1];
        }
        else {
            sum += girls[0] - boys[N-2];
        }
        for (int i = 1; i < M; i++) {
            sum += girls[i] - boys[N-1];
        }
        System.out.println(sum);

    }
}


import java.util.Arrays;
import java.util.Scanner;

public class PartyAndSweets {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int M = in.nextInt();
        int[] boys = new int[N];
        int[] girls = new int[M];
        long sum = 0;
        int max = 0;
        for (int i = 0; i < N; i++) {
            boys[i] = in.nextInt();
            sum += M * boys[i];
            max = Math.max(boys[i], max);
        }
        for (int i  = 0; i < M; i++) {
            girls[i] = in.nextInt();
            if (girls[i] < max) {
                System.out.println(-1);
                System.exit(0);
            }
        }
        Arrays.sort(boys);
        Arrays.sort(girls);
        if (girls[0] == boys[N-1]) {
            sum += girls[0] - boys[N-1];
        }
        else {
            sum += girls[0] - boys[N-2];
        }
        for (int i = 1; i < M; i++) {
            sum += girls[i] - boys[N-1];
        }
        System.out.println(sum);

    }
}


import java.util.Arrays;
import java.util.Scanner;

public class PartyAndSweets {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int M = in.nextInt();
        int[] boys = new int[N];
        int[] girls = new int[M];
        long sum = 0;
        int max = 0;
        for (int i = 0; i < N; i++) {
            boys[i] = in.nextInt();
            sum += (long)M * (long)boys[i];
            max = Math.max(boys[i], max);
        }
        for (int i  = 0; i < M; i++) {
            girls[i] = in.nextInt();
            if (girls[i] < max) {
                System.out.println(-1);
                System.exit(0);
            }
        }
        Arrays.sort(boys);
        Arrays.sort(girls);
        if (girls[0] == boys[N-1]) {
            sum += girls[0] - boys[N-1];
        }
        else {
            sum += girls[0] - boys[N-2];
        }
        for (int i = 1; i < M; i++) {
            sum += girls[i] - boys[N-1];
        }
        System.out.println(sum);

    }
}


import java.util.Arrays;
import java.util.Scanner;
import java.util.*;
public class Main {
    public static void main(String[] args)
    {
        Scanner stdin = new Scanner(System.in);
        /*int n = stdin.nextInt();
        for(int i = 0; i < n; i++)
        {
        	test(stdin);
        }*/
        test(stdin);
        stdin.close();
    }
    public static void test(Scanner stdin)
    {
    	int b = stdin.nextInt();
    	int g = stdin.nextInt();
    	int min[] = new int[b];
    	int max[] = new int[g];
    	for(int i = 0; i < b; i++)
    	{
    		min[i] = stdin.nextInt();
    	}
    	for(int i = 0; i < g; i++)
    	{
    		max[i] = stdin.nextInt();
    	}
    	mix(min);
    	mix(max);
    	Arrays.sort(min);
    	Arrays.sort(max);
    	int[] boy = new int[b];
    	int pos = g-1;
    	long sum = 0;
    	for(int i = b-1; i >= 0;)
    	{
    		if((boy[i] == g-1 && max[pos] != min[i]) || boy[i] == g)
    		{
    			i--;
    			continue;
    		}
    		if(min[i] > max[pos])
    		{
    			i--;
    			continue;
    		}
    		boy[i]++;
    		sum += max[pos];
    		pos--;
    		if(pos ==  -1)
    		{
    			break;
    		}
    	}
    	for(int i = 0; i < b; i++)
    	{
    		sum += ((long)min[i])*((long)(g-boy[i]));
    	}
    	if(pos != -1 || min[b-1] > max[0])
    	{
    		sum = -1;
    	}
    	System.out.println(sum);
    }
	public static void mix(int input[])
	{
		Random rand = new Random();
		for(int i = 0; i < input.length; i++)
		{
			int index = rand.nextInt(input.length);
			int temp = input[index];
			input[index] = input[i];
			input[i] = temp;
		}
	}
}


import java.util.Arrays;
import java.util.Scanner;
import java.util.*;
public class Main {
    public static void main(String[] args)
    {
        Scanner stdin = new Scanner(System.in);
        /*int n = stdin.nextInt();
        for(int i = 0; i < n; i++)
        {
        	test(stdin);
        }*/
        test(stdin);
        stdin.close();
    }
    public static void test(Scanner stdin)
    {
    	int b = stdin.nextInt();
    	int g = stdin.nextInt();
    	int min[] = new int[b];
    	int max[] = new int[g];
    	for(int i = 0; i < b; i++)
    	{
    		min[i] = stdin.nextInt();
    	}
    	for(int i = 0; i < g; i++)
    	{
    		max[i] = stdin.nextInt();
    	}
    	mix(min);
    	mix(max);
    	Arrays.sort(min);
    	Arrays.sort(max);
    	int[] boy = new int[b];
    	int pos = g-1;
    	long sum = 0;
    	for(int i = b-1; i >= 0;)
    	{
    		if((boy[i] == g-1 && max[pos] != min[i]) || boy[i] == g)
    		{
    			i--;
    			continue;
    		}
    		if(min[i] > max[pos])
    		{
    			i--;
    			continue;
    		}
    		boy[i]++;
    		sum += max[pos];
    		pos--;
    		if(pos ==  -1)
    		{
    			break;
    		}
    	}
    	for(int i = 0; i < b; i++)
    	{
    		sum += min[i]*(g-boy[i]);
    	}
    	if(pos != -1 || min[b-1] > max[0])
    	{
    		sum = -1;
    	}
    	System.out.println(sum);
    }
	public static void mix(int input[])
	{
		Random rand = new Random();
		for(int i = 0; i < input.length; i++)
		{
			int index = rand.nextInt(input.length);
			int temp = input[index];
			input[index] = input[i];
			input[i] = temp;
		}
	}
}


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

import static java.lang.Math.max;
import static java.lang.Math.min;

public class ProjectC {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        List<Integer> a = new ArrayList<>();
        List<Integer> b = new ArrayList<>();

        int sum_a = 0;
        int sum_b = 0;

        int max_a = Integer.MIN_VALUE;
        int min_b = Integer.MAX_VALUE;

        for (int i = 0; i < n; i++) {
            int e = in.nextInt();
            max_a = max(max_a, e);
            sum_a += e;
            a.add(e);
        }

        for (int i = 0; i < m; i++) {
            int e = in.nextInt();
            min_b = min(min_b, e);
            sum_b += e;
            b.add(e);
        }

        if (min_b < max_a) {
            System.out.println(-1);
            return;
        }

        int total = sum_a * m + sum_b;
        List<Integer> collect = a.stream().sorted((o1, o2) -> o2 - o1).collect(Collectors.toList());
        total = total - collect.get(0) * m;

        if (min_b > max_a) {
            total += collect.get(0) - collect.get(1);
        }

        System.out.println(total);
    }

}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

import static java.lang.Math.*;

public class ProjectC {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        List<Integer> a = new ArrayList<>();
        List<Integer> b = new ArrayList<>();

        int sum_a = 0;
        int sum_b = 0;

        int max_a = Integer.MIN_VALUE;
        int min_b = Integer.MAX_VALUE;

        for (int i = 0; i < n; i++) {
            int e = in.nextInt();
            max_a = max(max_a, e);
            sum_a += e;
            a.add(e);
        }

        for (int i = 0; i < m; i++) {
            int e = in.nextInt();
            min_b = min(min_b, e);
            sum_b += e;
            b.add(e);
        }

        if (min_b < max_a) {
            System.out.println(-1);
            return;
        }

        int total = sum_a * m + sum_b;
        List<Integer> collect = a.stream().sorted((o1, o2) -> o2 - o1).collect(Collectors.toList());
        if (min_b > max_a) {
            total = total - collect.get(0) * (m - 1) - collect.get(1);
        } else {
            total = total - collect.get(0) * m;
        }
        System.out.println(total);

    }

}


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

import static java.lang.Math.max;
import static java.lang.Math.min;

public class ProjectC {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        List<Integer> a = new ArrayList<>();
        List<Integer> b = new ArrayList<>();

        long sum_a = 0;
        long sum_b = 0;

        int max_a = Integer.MIN_VALUE;
        int min_b = Integer.MAX_VALUE;

        for (int i = 0; i < n; i++) {
            int e = in.nextInt();
            max_a = max(max_a, e);
            sum_a += e;
            a.add(e);
        }

        for (int i = 0; i < m; i++) {
            int e = in.nextInt();
            min_b = min(min_b, e);
            sum_b += e;
            b.add(e);
        }

        if (min_b < max_a) {
            System.out.println(-1);
            return;
        }

        long total = sum_a * (long) m + sum_b;
        List<Integer> collect = a.stream().sorted((o1, o2) -> o2 - o1).collect(Collectors.toList());
        total = total - collect.get(0) * (long) m;

        if (min_b > max_a) {
            total += collect.get(0) - collect.get(1);
        }

        System.out.println(total);
    }

}


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

import static java.lang.Math.max;
import static java.lang.Math.min;

public class ProjectC {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        List<Integer> a = new ArrayList<>();
        List<Integer> b = new ArrayList<>();

        long sum_a = 0;
        long sum_b = 0;

        int max_a = Integer.MIN_VALUE;
        int min_b = Integer.MAX_VALUE;

        for (int i = 0; i < n; i++) {
            int e = in.nextInt();
            max_a = max(max_a, e);
            sum_a += e;
            a.add(e);
        }

        for (int i = 0; i < m; i++) {
            int e = in.nextInt();
            min_b = min(min_b, e);
            sum_b += e;
            b.add(e);
        }

        if (min_b < max_a) {
            System.out.println(-1);
            return;
        }

        long total = sum_a * m + sum_b;
        List<Integer> collect = a.stream().sorted((o1, o2) -> o2 - o1).collect(Collectors.toList());
        total = total - collect.get(0) * m;

        if (min_b > max_a) {
            total += collect.get(0) - collect.get(1);
        }

        System.out.println(total);
    }

}


import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;

public class A {

	public static void main(String[] args) {
		JS in = new JS();
		int N = in.nextInt();
		int M = in.nextInt();
		ArrayList<Long> boyMin = new ArrayList<Long>();
		ArrayList<Long> girlMax = new ArrayList<Long>();
		for(int i = 0; i < N; i++) boyMin.add(in.nextLong());
		for(int i = 0; i < M; i++) girlMax.add(in.nextLong());
		Collections.sort(boyMin);
		Collections.sort(girlMax);

		if(boyMin.get(N-1) > girlMax.get(0)) {
			System.out.println(-1);
			return;
		}

		long total = 0;
		for(int i = 0; i < N; i++) {
			long boy = boyMin.get(i);
			total += boy*(long)(M);
		}

		int boyId = N-1;
		long maxBoy = boyMin.get(boyId);
		long numLeft = M-1;
		for(int i = 0; i < M; i++) {
			long girl = girlMax.get(i);
			if(girl > maxBoy) {
				if(boyId < 0) {
					System.out.println(-1);
					return;
				}
				total += girl-maxBoy;
				numLeft--;
				if(numLeft == 0) {
					boyId--;
					if(boyId >= 0) maxBoy = boyMin.get(boyId);
					numLeft = M-1;
				}
			}

		}
System.out.println(total);

	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
		    while(c!='.'&&c!='-'&&(c <'0' || c>'9')) c = nextChar();
		    boolean neg = c=='-';
		    if(neg)c=nextChar();
		    boolean fl = c=='.';
		    double cur = nextLong();
		    if(fl) return neg ? -cur/num : cur/num;
		    if(c == '.') {
			double next = nextLong();
			return neg ? -cur-next/num : cur+next/num;
		    }
		    else return neg ? -cur : cur;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}

}


import java.io.*;
import java.util.*;

public class pA {
	void run() {
		int n = in.nextInt();
		int m = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		int[] b = new int[m];
		for (int i = 0; i < m; i++) {
			b[i] = in.nextInt();
		}
		Arrays.sort(a);
		Arrays.sort(b);
		if (b[0] < a[n - 1]) {
			out.println(-1);
			return;
		}
		long ans = 0;
		for (int i = 0; i < n - 1; i++) {
			ans += m * (long) a[i];
		}
		for (int j = 0; j < m; j++) {
			ans += b[j];
		}
		if (b[0] > a[n - 1]) {
			ans += a[n - 1] - a[n - 2];
		}
		out.println(ans);
	}

	static MyScanner in;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		boolean stdStreams = true;
		String fileName = pA.class.getSimpleName().replaceFirst("_.*", "").toLowerCase();
		String inputFileName = fileName + ".in";
		String outputFileName = fileName + ".out";

		Locale.setDefault(Locale.US);
		BufferedReader br;
		if (stdStreams) {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			br = new BufferedReader(new FileReader(inputFileName));
			out = new PrintWriter(outputFileName);
		}
		in = new MyScanner(br);
		int tests = 1;//in.nextInt();
		for (int test = 0; test < tests; test++) {
			//out.print("Case #" + (test + 1) + ": ");
			new pA().run();
		}
		br.close();
		out.close();
	}

	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		MyScanner(BufferedReader br) {
			this.br = br;
		}

		void findToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}

		String next() {
			findToken();
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


import java.io.*;
import java.util.*;

public class pA {
	void run() {
		int n = in.nextInt();
		int m = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		int[] b = new int[m];
		for (int i = 0; i < m; i++) {
			b[i] = in.nextInt();
		}
		Arrays.sort(a);
		Arrays.sort(b);
		if (b[0] < a[n - 1]) {
			out.println(-1);
			return;
		}
		long ans = 0;
		for (int i = 0; i < n - 1; i++) {
			ans += m * (long) a[i];
		}
		for (int j = 0; j < m; j++) {
			ans += b[j];
		}
		if (b[0] == a[n - 1]) {
			out.println(ans);
			return;
		}
		out.println(ans + a[n - 1] - a[n - 2]);
	}

	static MyScanner in;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		boolean stdStreams = true;
		String fileName = pA.class.getSimpleName().replaceFirst("_.*", "").toLowerCase();
		String inputFileName = fileName + ".in";
		String outputFileName = fileName + ".out";

		Locale.setDefault(Locale.US);
		BufferedReader br;
		if (stdStreams) {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			br = new BufferedReader(new FileReader(inputFileName));
			out = new PrintWriter(outputFileName);
		}
		in = new MyScanner(br);
		int tests = 1;//in.nextInt();
		for (int test = 0; test < tests; test++) {
			//out.print("Case #" + (test + 1) + ": ");
			new pA().run();
		}
		br.close();
		out.close();
	}

	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		MyScanner(BufferedReader br) {
			this.br = br;
		}

		void findToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}

		String next() {
			findToken();
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


import java.io.*;
import java.util.*;

public class Sol {
	 static class FastReader
	    {
	        final private int BUFFER_SIZE = 1 << 16;
	        private DataInputStream din;
	        private byte[] buffer;
	        private int bufferPointer, bytesRead;

	        public FastReader()
	        {
	            din = new DataInputStream(System.in);
	            buffer = new byte[BUFFER_SIZE];
	            bufferPointer = bytesRead = 0;
	        }

	        public FastReader(String file_name) throws IOException
	        {
	            din = new DataInputStream(new FileInputStream(file_name));
	            buffer = new byte[BUFFER_SIZE];
	            bufferPointer = bytesRead = 0;
	        }

	        public String nextLine() throws IOException
	        {
	            byte[] buf = new byte[64]; // line length
	            int cnt = 0, c;
	            while ((c = read()) != -1)
	            {
	                if (c == '\n')
	                    break;
	                buf[cnt++] = (byte) c;
	            }
	            return new String(buf, 0, cnt);
	        }

	        public int nextInt() throws IOException
	        {
	            int ret = 0;
	            byte c = read();
	            while (c <= ' ')
	                c = read();
	            boolean neg = (c == '-');
	            if (neg)
	                c = read();
	            do
	            {
	                ret = ret * 10 + c - '0';
	            }  while ((c = read()) >= '0' && c <= '9');

	            if (neg)
	                return -ret;
	            return ret;
	        }

	        public long nextLong() throws IOException
	        {
	            long ret = 0;
	            byte c = read();
	            while (c <= ' ')
	                c = read();
	            boolean neg = (c == '-');
	            if (neg)
	                c = read();
	            do {
	                ret = ret * 10 + c - '0';
	            }
	            while ((c = read()) >= '0' && c <= '9');
	            if (neg)
	                return -ret;
	            return ret;
	        }

	        public double nextDouble() throws IOException
	        {
	            double ret = 0, div = 1;
	            byte c = read();
	            while (c <= ' ')
	                c = read();
	            boolean neg = (c == '-');
	            if (neg)
	                c = read();

	            do {
	                ret = ret * 10 + c - '0';
	            }
	            while ((c = read()) >= '0' && c <= '9');

	            if (c == '.')
	            {
	                while ((c = read()) >= '0' && c <= '9')
	                {
	                    ret += (c - '0') / (div *= 10);
	                }
	            }

	            if (neg)
	                return -ret;
	            return ret;
	        }

	        private void fillBuffer() throws IOException
	        {
	            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
	            if (bytesRead == -1)
	                buffer[0] = -1;
	        }

	        private byte read() throws IOException
	        {
	            if (bufferPointer == bytesRead)
	                fillBuffer();
	            return buffer[bufferPointer++];
	        }

	        public void close() throws IOException
	        {
	            if (din == null)
	                return;
	            din.close();
	        }
	    }

	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static final long mod = (long)(1e9+7);

	//static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) throws IOException {
		FastReader sc = new FastReader();
		// TODO Auto-generated method stub
		int n = sc.nextInt();
		int m = sc.nextInt();
		long sumb = 0,maxb1 = -1,maxb2 = -1,sumg = 0,ming = Long.MAX_VALUE;
		for(int i=0;i<n;++i) {
			long x = sc.nextLong();
			sumb+=x;
			if(x>=maxb1) {
				maxb2 = maxb1;
				maxb1 = x;
			}else if(x>maxb2) {
				maxb2 = x;
			}
		}
		for(int i=0;i<m;++i) {
			long x = sc.nextLong();
			sumg+=x;
			ming = Math.min(ming, x);
		}
		long ans = 0;
		if(maxb1>ming) ans = -1;
		else if(maxb1 == ming)
		     ans = 1L*sumb*m+sumg-1L*maxb1*m;
		else if(maxb1<ming)
		     ans = 1L*sumb*m+sumg-maxb1*(m-1)-maxb2;

		out.println(ans);
	 out.close();
	}

}