#include <bits/stdc++.h>
using namespace std;
template <class T>
int64_t sum(vector<T> a);
template <class T>
double ave(vector<T> a);
template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v);
uint64_t gcd(int64_t a, int64_t b);
uint64_t lcm(int64_t a, int64_t b);
bool flagdebug = false;
int main() {
  flagdebug = true;
  int64_t n;
  cin >> n;
  vector<uint64_t> a(n);
  vector<uint64_t> b0(60, 0);
  vector<uint64_t> b1(60, 0);
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    for (int j = 0; j < (int)(60); j++) {
      if (a[i] & ((uint64_t)1 << j)) {
        b1[j]++;
      } else {
        b0[j]++;
      }
    }
  }
  uint64_t ans = 0;
  for (int j = 0; j < (int)(60); j++) {
    ans += ((uint64_t)1 << j) * b0[j] * b1[j];
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  s << "[\t";
  for (auto i = v.begin(); i < v.end() - 1; i++) {
    s << *i << "\t";
  }
  s << *(v.end() - 1) << "\t]\n";
  return s;
}
uint64_t gcd(int64_t a, int64_t b) {
  if (b != 0) {
    return gcd(b, a % b);
  }
  return a;
}
uint64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; }
