#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t con = 1000000007LL;
  int N;
  cin >> N;
  vector<bitset<60>> A(N);
  for (int i = 0; i < N; i++) {
    int64_t Ai;
    cin >> Ai;
    A.at(i) = bitset<60>(Ai);
  }
  int64_t sum = 0;
  for (int i = 0; i < 60; i++) {
    int num0 = 0;
    int num1 = 0;
    for (int j = 0; j < N; j++) {
      if (A.at(j).test(i)) {
        num1++;
      } else {
        num0++;
      }
    }
    int64_t sum_temp = (int64_t)(num0 * num1);
    for (int j = 0; j < i; j++) {
      sum_temp *= 2;
      sum_temp %= con;
    }
    sum += sum_temp;
    sum %= con;
  }
  cout << sum << endl;
}
