#include <bits/stdc++.h>

using namespace std;

void solve(){
    int n;
    cin>>n;
    n*=2;
    int a[n],b[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    sort(b,b+n);
    vector<pair<int,int>> ai;
    unordered_map<int,vector<int>> mp;
    unordered_map<int,int> cnt;
    for(int i=0;i<n;i++){
        mp[b[i]].push_back(i);
    }
    for(int i=0;i<n;i++){
        ai.push_back(make_pair(a[i],mp[a[i]][cnt[a[i]]]));
        cnt[a[i]]++;
    }
    string ans(n,' ');
    int khaali=n,open=0;
    int right[n];
    // for(int i=0;i<n;i++){
    //     cout<<ai[i].first<<' '<<ai[i].second<<'\n';
    // }
    for(int i=n-1;i>=0;i--){
        // cout<<i<<' '<<khaali<<'\n';
        if(ai[i].second<(n/2)){
            if(khaali<n){
                ans[i]='(';
                ans[khaali]=')';
                khaali=right[khaali];
            }
            else{
                ans[i]=')';
                open++;
            }
        }
        else{
            if(open>0){
                ans[i]='(';
                open--;
            }
            else{
                right[i]=khaali;
                khaali=i;
            }
        }
    }
    // assert(open==0);
    cout<<ans<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i=a; i<b; ++i)
#define FORR(i, a, b) for(int i=a; i>b; --i)
#define all(x) (x).begin(), (x).end()
#define printCon(con) for(const auto &x: con) cout<<x<<" "
#define MOD 1000000007

// operator overloading

template<typename T>
istream& operator>>(istream &istream, vector<T>& a)
{
	for (auto &it : a)
		istream >> it;
	return istream;
}

template<typename T>
ostream& operator<<(ostream &stream, vector<T>& v)
{
	for (const auto &it : v)
		stream << it << " ";
	return stream;
}

// Mathematical functions

int GCD(int a, int b) {
	if(b==0) return a;
	return GCD(b, a%b);
}

// #####START YOUR CODE HERE#####

void solve(int tc) {

	int n; cin>>n;
	int range = 0, arr[n];
	for(int i=0; i<n; ++i) {
		cin>>arr[i]; range += arr[i];
	}

	int sum = range/2;

	bool dp[n+1][sum+1];

	for(int i=0; i<=n; ++i) dp[i][0] = true;
	for(int j=1; j<=sum; ++j) dp[0][j] = false;

	for(int i=1; i<=n; ++i) {
		for(int j=1; j<=sum; ++j) {
			if(j - arr[i-1] >= 0) dp[i][j] = dp[i-1][j] || dp[i-1][j-arr[i-1]];
			else dp[i][j] = dp[i-1][j];
		}
	}

	int ans;

	for(int j=sum; j>=0; --j) {
		if(dp[n][j]) {
			ans = j; break;
		}
	}

	cout<<range-ans;

}

int main() {

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	
	int t = 1;
	// cin>>t;

	FOR(i, 1, t+1) {
		solve(i);
	} 
	
	return 0;
}

