#include <bits/stdc++.h>
using namespace std;
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
unsigned long long powOf2(int k) {
  if (k == 0) return 1;
  return 2 * powOf2(k - 1);
}
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<unsigned long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  unsigned long long odd = 0;
  unsigned long long even = 0;
  unsigned long long ans = 0;
  unsigned long long temp = 0;
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < N; j++) {
      if (((A[j] >> i) & 1)) {
        even++;
      } else {
        odd++;
      }
    }
    temp = (odd * even) * powOf2(i);
    ans += temp;
    odd = 0;
    even = 0;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
