#include "bits/stdc++.h"

#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define eb emplace_back
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)
#define mmst(v) memset(v, 0, sizeof(v))

template<typename T1,typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 & a, T2 b) { if (a < b) a = b; }

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kMax9 = 1000000010;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;
const long long kMod = 1000000007;

const long long kMAX = 1000000000;

using namespace std;
using ll = long long;

inline int readInt() {
  char c = getchar();
  while(!isdigit(c) && c != '-') c = getchar();
  int sigma = 1;
  if (c == '-') {
    sigma = -1;
    c = getchar();
  }
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * sigma;
}

template <class T>
void PrintVector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void PrintVector(const vector<T> & v, int n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}

double dist(double lhs, double rhs) {
  return sqrt(lhs * lhs + rhs * rhs);
}

// int binary(int bina){
//   int ans = 0;
//   for (int i = 0; bina>0 ; i++)
//   {
//     ans = ans+(bina%2)*pow(10,i);
//     bina = bina/2;
//   }
//   return ans;
// }

const long km = 62;

long n, m, k, t;
string binary(ll dec){
  string s;
  while (dec > 0) {
    s.pb((dec % 2) + '0');
    dec /= 2;
  }
  auto j = km - long(s.size());
  rep(i, 0, j - 1) { s.pb('0'); }
  // reverse(s.begin(), s.end());
  return s;
}

ll exp2k(long x) {
  ll ans = 1;
  rep(i, 1, x) {
    ans = (ans * x) % kMod;
  }
  return ans;
}

int main() {
  ll ans = 0;
  vector<string> ss;
  vector<ll> aa;
  vector<ll> cnt;
  cin >> n;
  rep(i, 0, n - 1) {
    ll a0;
    cin >> a0;
    aa.pb(a0);
    auto s0 = binary(a0);
    ss.pb(s0);
    // cout << s0 << endl;
  }

  per(i, km - 1, 0) {
    ll x = 0;
    ll y = 0;
    rep(j, 0, n - 1) {
      if (ss[j][i] == '0') { ++x; }
      else { ++y; }
    }
    ans = (ans + x * y % kmod * ll(exp2(i))) % kMod;
  }

  cout << ans << endl;

  return 0;
}
