#include <bits/stdc++.h>
using namespace std;
struct debugger {
  template <typename T>
  debugger& operator,(const T& x) {
    clog << x << " ";
    return *this;
  }
} dbg;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " | ";
  __f(comma + 1, args...);
}
auto ____ = []() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  return nullptr;
}();
int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  ;
  vector<unsigned long long> v(n);
  for (auto& x : v) cin >> x;
  ;
  vector<unsigned long long> cnt(60, 0);
  for (int i = 0; i < (n); ++i) {
    unsigned long long x = v[i];
    unsigned long long b = 1;
    for (int j = 0; j < (60); ++j) {
      if (x & (b << j)) cnt[j]++;
    }
  };
  unsigned long long res = 0;
  for (int i = 0; i < (60); ++i) {
    unsigned long long tmp = cnt[i] * (n - cnt[i]);
    ;
    unsigned long long fact = (1LL << i) % (int)1000000007;
    tmp *= fact;
    ;
    tmp %= (int)1000000007;
    res += tmp;
    res %= (int)1000000007;
  }
  cout << res << endl;
  return 0;
}
