#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  int i, j;
  for (i = 0; i < n; i++) cin >> a.at(i);
  vector<long long> sum1(60, 0);
  long long ans = 0;
  for (i = 0; i < 60; i++) {
    for (j = 0; j < n; j++) {
      if (((long long)1 << i) & a.at(j)) sum1.at(i)++;
    }
  }
  long long ks = 1;
  for (i = 0; i < 60; i++) {
    ans = (ans + sum1.at(i) * (n - sum1.at(i)) * ks) % 1000000007;
    ks = (ks * 2) % 1000000007;
  }
  cout << ans % 1000000007 << endl;
}
