#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 62) - 1;
ll ceil(const ll& a, const ll& b) { return ((a) + (b)-1) / b; }
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const ll mod = 1e9 + 7;
ll Modpow(ll a, int n) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    ll res = Modpow(a, n / 2);
    return res * res % mod;
  }
  return a * Modpow(a, n - 1) % mod;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vl a(n);
  for (ll i = 0; i < n; i++) cin >> a[i];
  vi cnt(60);
  for (ll i = 0; i < n; i++) {
    bitset<60> b(a[i]);
    for (ll j = 0; j < 60; j++) {
      if (b[j]) cnt[j]++;
    }
  }
  ll ans = 0;
  for (ll i = 0; i < 60; i++) {
    ll cur = Modpow(2, i) * cnt[i] * (n - cnt[i]);
    cur %= mod;
    ans += cur;
    ans %= mod;
  }
  cout << ans << '\n';
}
