#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e9 + 7);
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  long long r = 0;
  for (int k = 0; k < (int)(60); k++) {
    long long m = 0;
    for (int i = 0; i < (int)(n); i++) m += (a[i] >> k) % 2;
    r = (r + (n - m) * m * ((1L << k) % mod)) % mod;
  }
  cout << r << endl;
  return 0;
}
