#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void ZZ(const char* name, Arg1&& arg1) {
  std::cerr << name << " = " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void ZZ(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1;
  ZZ(comma, args...);
}
const long long MOD = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  vector<long long> a(n + 1);
  for (int i = 1; i < n + 1; i++) cin >> a[i];
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    long long z = 0, o = 0;
    long long k = (1ll << i);
    for (int j = 1; j < n + 1; j++) {
      if (k & a[j])
        o++;
      else
        z++;
    }
    long long kk = k;
    k *= (z * o);
    ans = (ans + k) % MOD;
  }
  cout << ans << "\n";
}
int main() {
  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
