#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N = 0;
  vector<long long> A(N);
  for (int(i) = 0; (i) < (N); (i)++) {
    cin >> A.at(i);
  }
  vector<long long> keta(65);
  for (int(k) = 0; (k) < (60); (k)++) {
    int s = 0;
    int t = 0;
    for (int(i) = 0; (i) < (N); (i)++) {
      if (((A.at(i) >> k) & 0x01) == 1) {
        t++;
      } else {
        s++;
      }
    }
    long long u = s * t;
    keta.at(k) = u;
  }
  for (int(k) = 0; (k) < (64); (k)++) {
    keta.at(k + 1) += (keta.at(k) / 2);
    if (keta.at(k) % 2 == 1) keta.at(k) = 1;
  }
  long long ret = 0;
  for (int(k) = 0; (k) < (65); (k)++) {
    ret += pow(k, 2) * keta.at(k);
    ret /= (1000000000 + 7);
  }
  cout << ret << endl;
  return 0;
}
