#include <bits/stdc++.h>
int main(int argc, char** argv) {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);
  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);
  int N, a[66] = {0}, b[66] = {0};
  long long A[333333];
  std::cin >> N;
  for (int i = 0; i < N; i++) {
    std::cin >> A[i];
    for (int j = 0; j < 62; j++)
      if (A[i] & (1LL << j)) a[j]++;
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 62; j++)
      if (A[i] & (1LL << j)) a[j]--;
    for (int j = 0; j < 62; j++) {
      int c = a[j], d = N - 1 - i - c;
      b[j] += (A[i] & (1LL << j)) ? d : c;
    }
  }
  long long S = 0;
  for (int i = 0; i < 62; i++)
    (S += (b[i] * (1LL << i)) % 1000000007) %= 1000000007;
  std::cout << S << std::endl;
  return 0;
}
