#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

ll mod = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll n;
  cin >> n;
  vector<ll> one(63, 0);
  vector<ll> zero(63, 0);
  rep(i, n) {
    ll a;
    cin >> a;

    for (int j = 0; j < 63; j++) {
      if ((a >> j) & 1) {
        one[j]++;
      } else {
        zero[j]++;
      }
    }
  }
/*
  rep(i, 60) {
    cerr << one[i] << " ";
  }
  cerr << endl;
  rep(i, 60) {
    cerr << zero[i] << " ";
  }
  cerr << endl;
*/
  ll ans = 0;
  for (ll i = 0; i < one.size(); i++) {
    ll base = pow(ll(2), i) % mod;
    ll x = (one[i] * zero[i]) % mod;
    ans += (x * base) % mod;
    ans %= mod;
  }

  cout << ans << endl;

  return 0;
}
