#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")

#define DEBUG(x) cout << ">> " << #x << ": " << x << endl;
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll MOD = 1000000007;
typedef long long ll;
typedef long double ld;

int main() { _
  ll n; cin >> n;
  vector<ll> v(n);
  ll total = 0;
  for (ll i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (ll i = 0; i < 64; i++) {
    ll oc=0, zc=0;
    for (ll j = 0; j < n; j++) {
      if (v[j]&1) oc++;
      else zc++;
      v[j] >>= 1;
    }
    ll ibsum = ((oc*zc)%MOD) * ((1<<i)%MOD);
    total += ibsum%MOD;
    total %= MOD;
  }
  cout << total << endl;
  return 0;
}