#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
template <typename T>
T modpow(T x, T n, const T& p) {
  T ret = 1;
  while (n > 0) {
    if (n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
int main() {
  init();
  int N;
  cin >> N;
  map<int, ll> mp;
  for (int(i) = (int)(0); (i) < (int)(N); ++(i)) {
    ll a;
    cin >> a;
    for (int j = 0; (1LL << j) <= a; ++j) {
      if (a & (1LL << j)) mp[j]++;
    }
  }
  ll ans = 0;
  for (auto p : mp) {
    ans += (p.second * (N - p.second) * modpow(2LL, (ll)p.first, mod));
    ans %= mod;
  }
  cout << ans << "\n";
  return 0;
}
