#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
int main() {
  unsigned long long n;
  cin >> n;
  unsigned long long k[61];
  for (unsigned long long i = 0; i < (unsigned long long)(61); i++) k[i] = 0;
  unsigned long long one = 1;
  for (unsigned long long i = 0; i < (unsigned long long)(n); i++) {
    unsigned long long a;
    cin >> a;
    for (unsigned long long j = 0; j < (unsigned long long)(61); j++)
      if (a & (one << j)) k[j]++;
  }
  unsigned long long sum = 0;
  for (unsigned long long i = 0; i < (unsigned long long)(61); i++) {
    unsigned long long dat = (k[i] * (n - k[i]) * (one << i)) % 1000000007;
    sum += dat;
    sum %= 1000000007;
  }
  cout << sum << endl;
  return 0;
}
