#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<long double, long double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
template <typename AT>
void printvec(vector<AT> &ar) {
  for (int i = 0; i < (ar.size() - 1); ++i) cout << ar[i] << " ";
  cout << ar[ar.size() - 1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar) {
  for (int i = 0; i < (ar.size()); ++i) {
    for (int j = 0; j < (ar[0].size() - 1); ++j) cout << ar[i][j] << " ";
    cout << ar[i][ar[0].size() - 1] << endl;
  }
}
template <typename S>
bool range(S a, S b, S x) {
  return (a <= x && x < b);
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<ll> ar(n);
  for (int i = 0; i < (n); ++i) cin >> ar[i];
  ll ans = 0;
  for (long long i = 0; i < (63); ++i) {
    ll a = 0;
    ll b = 0;
    for (int j = 0; j < (n); ++j) {
      if (ar[j] >> i & 1)
        a++;
      else
        b++;
    }
    ll k = a * b * modpow(2LL, i, MOD);
    ans += k % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
