#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  long long ans = 0;
  for (int k = 0; k < (int)(60); k++) {
    long long odd = 0, even = 0;
    for (int j = 0; j < (int)(n); j++) a[j] >> k & 1 ? odd++ : even++;
    ans += odd * even * (long long)pow(2, k) % mod;
  }
  cout << ans % mod << endl;
}
