#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int64_t p = 1000000007;
  vector<int64_t> b(60);
  for (int i = 0; i < n; i++) {
    int64_t a;
    cin >> a;
    for (int d = 0; d < 60; d++) {
      b.at(d) += a % 2;
      a /= 2;
    }
  }
  int64_t s = 0;
  for (int d = 0; d < 60; d++)
    s = (s + ((1LL << d) % p * (b.at(d) * (n - b.at(d))) % p) % p) % p;
  cout << s << endl;
}
