#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long int> a(n);
  for (auto& in : a) {
    cin >> in;
  }
  vector<int> d(60, 0);
  long long p = 1;
  for (auto i = 0; i < 60; ++i) {
    long int mask = p;
    for (const auto& x : a) {
      if (x & mask) {
        d[i]++;
      }
    }
    p *= 2;
  }
  long int ans = 0;
  p = 1;
  for (auto i = 0; i < 60; ++i) {
    long long pp = p % static_cast<long long>(1e9 + 7);
    ans += pp * d[i] * (n - d[i]);
    p *= 2;
    ans %= static_cast<long long>(1e9 + 7);
  }
  cout << ans;
}
