#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> zero(60, 0), one(60, 0);
  for (int(i) = 0; i < (n); i++) {
    long long a;
    cin >> a;
    for (int(j) = 0; j < (60); j++) {
      (a % 2 ? one : zero).at(j)++;
      a /= 2;
    }
  }
  long long ans = 0;
  for (long long i = 0; i <= 60; i++) {
    ans += (long long)pow(2, i) * zero.at(i) * one.at(i);
    ans %= 1000000007;
  }
  cout << ans;
}
