#include <bits/stdc++.h>
using namespace std;
int N;
int num_1[64];
void Solve() {
  unsigned long long sum = 0LL;
  unsigned long long pwr2 = 1LL;
  for (int digit = 0; digit <= 61; ++digit, pwr2 <<= 1) {
    unsigned long long sum_in_this_digit = num_1[digit] * (N - num_1[digit]);
    sum_in_this_digit *= pwr2;
    sum += sum_in_this_digit;
    sum %= 1000000007;
  }
  cout << sum << endl;
}
void Init() {
  cin >> N;
  for (int i = 0; i < N; ++i) {
    unsigned long long in_value;
    cin >> in_value;
    int digit = 0;
    while (1) {
      if (in_value & 1) ++num_1[digit];
      ++digit;
      in_value >>= 1;
      if (1 > in_value) break;
    }
  }
}
int main() {
  Init();
  Solve();
  return 0;
}
