#include <bits/stdc++.h>
using namespace std;
long long int d[64];
void func(long long N, std::vector<long long> A) {
  long long int sum = 0;
  long long int maxA = 0;
  for (int i = 0; i < N; i++) {
    maxA = max(maxA, A[i]);
    for (int j = 0; j < 62; j++) {
      if (A[i] & (1LL << j)) d[j]++;
    }
  }
  long long int two = 1;
  for (int i = 0; i < 62; i++) {
    if (maxA < (1LL << i)) break;
    sum += (two * (d[i]) * (N - d[i])) % 1000000007;
    sum %= 1000000007;
    two *= 2;
    two %= 1000000007;
  }
  cout << sum << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  func(N, std::move(A));
  return 0;
}
