#include <bits/stdc++.h>
long long MOD = 1e9 + 7;
int main() {
  int n;
  std::cin >> n;
  std::vector<long long> a(n);
  for (int i = 0; i < n; ++i) std::cin >> a[i];
  int M = 62;
  std::vector<long long> store(M, 0);
  for (int k = 0; k < M; ++k) {
    int num_0 = 0;
    int num_1 = 0;
    for (auto v : a) {
      if (v & (1LL << k))
        num_1 += 1;
      else
        num_0 += 1;
    }
    store[k] = num_1 * num_0;
  }
  long long res = 0;
  for (int k = M - 1; k >= 0; --k) {
    res *= 2;
    res += store[k];
    res %= MOD;
  }
  std::cout << res << std::endl;
}
