#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T x) {
  std::cout << x << " ";
}
template <typename T>
void println(T x) {
  std::cout << x << "\n";
}
long long modpow(long long a, long long p) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    long long halfP = p / 2;
    long long half = modpow(a, halfP);
    return half * half % 1000000007;
  } else {
    return a * modpow(a, p - 1) % 1000000007;
  }
}
signed main(void) {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  long long ret = 0;
  for (long long i = 0; i < (60); i++) {
    long long zero = 0;
    for (long long j = 0; j < (n); j++) {
      if (a[j] >> i & 1) zero++;
    }
    ret += zero * (n - zero) * modpow(2, i);
    ret %= 1000000007;
  }
  print(ret);
}
