#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main(int argc, char const* argv[]) {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  ll ans = 0;
  for (int bit = 0; bit < 60; bit++) {
    int ones = 0;
    for (int i = 0; i < (n); i++) {
      if (a[i] & 1ll << bit) ones++;
    }
    ans =
        ll(ans) + ((1ll << bit) % 1000000007 * ones * (n - ones) % 1000000007) %
                      1000000007;
  }
  cout << ans << endl;
  return 0;
}
