#include <bits/stdc++.h>
using namespace ::std;
template <class T>
istream& operator>>(istream& I, vector<T>& v) {
  for (T& e : v) I >> e;
  return I;
}
template <class T>
ostream& operator<<(ostream& O, const vector<T>& v) {
  for (const T& e : v) O << e << ' ';
  return O;
}
void _main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  cin >> a;
  long long ans = 0;
  for (int bit = 60; bit >= 0; bit--) {
    int cnt[2]{};
    for (int i = 0; i < n; i++) {
      cnt[!!(1LL << bit & a[i])]++;
    }
    (ans += (cnt[0] * cnt[1] * (1LL << bit))) %= (long long)(1e9 + 7);
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int _t = 1;
  while (_t--) _main();
  return 0;
}
