#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;
void setfspattern_core(int floor, int number, int degree) {
  if (floor == degree) {
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  } else {
    for (int64_t i = 0; i < (int64_t)(number); i++) {
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor + 1, number, degree);
    }
  }
}
void setfspattern(int number, int degree) {
  fspcnt = 0;
  int64_t array_num = 1;
  for (int64_t i = 0; i < (int64_t)(degree); i++) {
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num, vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0, number, degree);
}
int main() {
  int64_t n;
  cin >> n;
  vector<int64_t> a(n);
  for (int64_t i = 0; i < (int64_t)(n); i++) {
    cin >> a.at(i);
  }
  int64_t b = 1;
  int64_t total = 0;
  int64_t G = 1000000007;
  for (int64_t i = 0; i < (int64_t)(61); i++) {
    int64_t cnt = 0;
    for (int64_t j = 0; j < (int64_t)(n); j++) {
      cnt += (a.at(j) & b) >> i;
    }
    total = (total + ((b * (n - cnt)) % G) * cnt) % G;
    b = b << 1;
  }
  cout << total << endl;
}
