#include <bits/stdc++.h>
const int inf = 1e9 + 7;
const long long infll = 1ll << 60ll;
const long long mod = 1e9 + 7;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};
template <typename T>
void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <typename T>
void chmin(T& a, T b) {
  a = std::min(a, b);
}
template <typename T>
void chadd(T& a, T b) {
  a = a + b;
}
namespace {
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void CalcDigitNum(long long a, std::vector<long long>& digit_num) {
  int cnt = 0;
  while (a != 0) {
    if (a % 2 == 1) ++digit_num[cnt];
    a /= 2;
    ++cnt;
  }
}
}  // namespace
int main() {
  long long n;
  std::cin >> n;
  std::vector<long long> a(n);
  for (int i = 0; i < n; ++i) std::cin >> a[i];
  std::vector<std::vector<long long>> digit_num(
      n, std::vector<long long>(60, 0LL));
  for (int i = 0; i < n; ++i) {
    CalcDigitNum(a[i], digit_num[i]);
  }
  long long ans = 0LL;
  for (int i = 0; i < 60; ++i) {
    long long zero_num = 0LL;
    long long one_num = 0LL;
    for (int j = 0; j < n; ++j) {
      zero_num += 1 - digit_num[j][i];
      one_num += digit_num[j][i];
    }
    ans += zero_num * one_num * ((1LL << i) % mod);
    ans %= mod;
  }
  std::cout << ans << std::endl;
  return 0;
}
