#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template <class T>
using v = vector<T>;
template <class T>
T read() {
  T x{};
  cin >> x;
  return x;
}
template <class T>
v<T> read(int N) {
  v<T> x(N);
  for (int i = 0; i < N; ++i) cin >> x[i];
  return x;
}
template <class T>
void write(const T &x) {
  cout << x << endl;
}
void write(double x) { printf("%.15f\n", x); }
const ull C = 1000000007;
int main() {
  auto N = read<ll>();
  auto A = read<ull>(N);
  v<ull> a0(63, 0), a1(63, 0);
  ull ans = 0;
  for (int i = 0; i < 63; ++i) {
    for (int j = 0; j < N; ++j) {
      if (A[j] & (1ULL << i))
        a1[i]++;
      else
        a0[i]++;
    }
    ans += a1[i] * a0[i] * (1ULL << i) % C;
    ans %= C;
  }
  write(ans);
}
