#include <bits/stdc++.h>
template <long long int Modulus>
class modint {
 public:
  long long int a;
  modint(const long long int x = 0) noexcept : a(x % Modulus) {}
  long long int &value() noexcept { return a; }
  const long long int &value() const noexcept { return a; }
  modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  modint &operator/=(modint rhs) noexcept {
    long long int exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};
int main(void) {
  int n;
  std::cin >> n;
  std::vector<long long int> A(n);
  modint<1000000007> ret = 0;
  for (int i = 0; i < n; i++) {
    std::cin >> A[i];
    ret += A[i];
  }
  ret *= n * 2;
  for (int i = 0; i < n; i++) {
    ret -= 2 * A[i];
  }
  ret /= 2;
  std::vector<long long int> bit_count(64, 0);
  for (int j = 0; j < 64; j++) {
    for (int i = 0; i < n; i++) {
      if ((A[i] >> j) % 2) bit_count[j]++;
    }
  }
  for (int j = 0; j < 64; j++) {
    if (bit_count[j] == 0) continue;
    modint<1000000007> val = bit_count[j] * (bit_count[j] - 1);
    modint<1000000007> hoge = (1 << j);
    val *= hoge;
    ret -= val;
  }
  std::cout << ret.a << std::endl;
  return 0;
}
