#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool CHMAX(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool CHMIN(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
constexpr long long INF = 1e18, MOD = 1000000007;
signed main() {
  long long N;
  cin >> N;
  vector<long long> a(N);
  for (long long i = 0; i < (long long)(N); i++) cin >> a[i];
  vector<long long> bit(60, 0);
  for (long long i = 0; i < (long long)(N); i++) {
    for (long long j = 0; j < (long long)(60); j++) {
      if (a[i] & (1ll << j)) bit[j]++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < (long long)(N); i++) {
    for (long long j = 0; j < (long long)(60); j++) {
      if (a[i] & (1ll << j)) bit[j]--;
      long long t = bit[j];
      long long f = N - i - 1 - bit[j];
      if (a[i] & (1ll << j))
        ans += (1ll << j) * f;
      else
        ans += (1ll << j) * t;
      ans %= MOD;
    }
  }
  cout << ans << endl;
}
