#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
  long long n;
  cin >> n;
  vector<long long> checker(60, 1);
  for (long long i = 0; i < 60; ++i) {
    checker[i] <<= i;
  }
  vector<long long> ca(60, 0);
  for (long long i = 0; i < n; ++i) {
    long long a;
    cin >> a;
    for (long long j = 0; j < 60; ++j) {
      if (checker[j] & a) {
        ++ca[j];
      }
    }
  }
  long long ret = 0;
  for (long long i = 0; i < 60; ++i) {
    ret += (ca[i] * (n - ca[i]) % mod * ((1LL << i)) % mod);
    ret %= mod;
  }
  cout << ret << endl;
  return 0;
}
