#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
using namespace __gnu_pbds;
 
#define debug(s) cout << #s << " = " << s << endl
#define all(v) (v).begin(), (v).end()
#define mem(a,val) memset(a, val, sizeof a)
 
#define maxn 300010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;
 
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int mod = 1e9 + 7;

int n;
ll arr[maxn], b[2][62];
ll ans;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> arr[i];
    if (i != 1) {
      for (int j = 0; j <= 60; ++j) {
        if (arr[i] & (1LL << j)) b[1][j]++;
        else b[0][j]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= 60; ++j) {
      if (arr[i] & (1LL << j)) {
        if (i != 1) b[1][j]--;
        ans = (ans + (b[0][j] * (1LL << j) % mod) % mod) % mod;
      }
      else {
        if (i != 1) b[0][j]--;
        ans = (ans + (b[1][j] * (1LL << j) % mod) % mod) % mod;
      }
    }
  }
  cout << ans << endl;
}



