#include <bits/stdc++.h>
using namespace std;
int N;
vector<double> A;
int a[70];
int main() {
  cin >> N;
  A.resize(N);
  for (int i = 0; i < (N); i++) {
    cin >> A[i];
    double AA = A[i];
    int j = 0;
    while (AA > 0) {
      if (fmod(AA, 2) == 1) {
        a[j]++;
      }
      j++;
      AA = floor(AA / 2);
    }
  }
  long double ans = 0;
  for (int i = 0; i < (70); i++) {
    long double b = fmod(fmod(pow(2, i), 1000000007) * a[i], 1000000007);
    ans += fmod(b * (N - a[i]), 1000000007);
  }
  cout << fixed << setprecision(0) << fmod(ans, 1000000007) << endl;
}
