#include <bits/stdc++.h>
using namespace std;
long long dataset[300005] = {0};
int main() {
  int number;
  cin >> number;
  for (int i = 0; i < number; i++) cin >> dataset[i];
  long long result = 0;
  for (long long i = 0; i < 64; i++) {
    long long zeros = 0, ones = 0;
    for (long long j = 0; j < number; j++) {
      if (dataset[j] % 2ll == 1)
        ones++;
      else
        zeros++;
      dataset[j] /= 2ll;
    }
    result +=
        ((ones * zeros) % 1000000007 * ((1 << i) % 1000000007)) % 1000000007;
    result %= 1000000007;
  }
  cout << result << endl;
}
