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

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
	int N;
	cin >> N;
	vector<ll> A(N);
	int num_minus = 0;
	for(int i=0; i<N; i++){
		ll a;
		cin >> a;
		if(a<0){
			num_minus++;
			a *= -1;
		}
		A[i] = a;
	}
	
	sort(A.rbegin(), A.rend());
	ll ans = 0;
	for(int i=0; i<N; i++) ans += A[i];
	if(num_minus % 2 ==1) ans -= 2*A.back();
	cout << ans << endl;
	
	return 0;
}


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

#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map

void doit(){
    ll n,i,k,j;
    cin >> n;
    vector< ll >v(n);
    for(i = 0; i < n; i++)cin>>v[i];
    vector<pii>answer(61,{0,0});
    rep(i,0,n){
        rep(j,0,61){
            if(v[i] & (1LL << j) )answer[j].ff++;
            else answer[j].ss++;
        }
    }
    ll ans = 0,mod = 1e9+7;
    rep(i,0,61){
        ll k1 = (answer[i].ff * answer[i].ss)%mod ;
        ll k2 = (1LL << i)%mod;
        k1 = (k1*k2)%mod;
        ans = ((ans % mod) + (k1 % mod)) % mod;
    }
    cout << ans;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}
