#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1000000000000000;
template <class T>
inline bool chmin(T& first, T second) {
  if (first > second) {
    first = second;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& first, T second) {
  if (first < second) {
    first = second;
    return true;
  }
  return false;
}
long long maxx(long long x, long long y, long long z) {
  return max(max(x, y), z);
}
long long minn(long long x, long long y, long long z) {
  return min(min(x, y), z);
}
long long gcd(long long x, long long y) {
  if (x % y == 0)
    return y;
  else
    return gcd(y, x % y);
}
long long lcm(long long x, long long y) { return x * (y / gcd(x, y)); }
long long digsz(long long x) {
  if (x == 0)
    return 1;
  else {
    long long ans = 0;
    while (x) {
      x /= 10;
      ans++;
    }
    return ans;
  }
}
long long digsum(long long x) {
  long long sum = 0;
  while (x) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}
vector<long long> pw2(62, 1);
vector<long long> pw10(19, 1);
int main() {
  {
    for (long long i = 1; i <= (61); i++) pw2[i] = 2 * pw2[i - 1];
  }
  {
    for (long long i = 1; i <= (18); i++) pw10[i] = 10 * pw10[i - 1];
  }
  long long N;
  cin >> N;
  vector<long long> A(N);
  long long sum = 0;
  for (long long i = 0; i < (N); i++) {
    cin >> A[i];
    sum += A[i];
    sum %= MOD;
  }
  vector<long long> one(61, 0);
  for (long long i = 0; i < (N); i++) {
    for (long long j = 0; j < (61); j++) {
      if ((A[i] & pw2[j]) == pw2[j]) one[j]++;
    }
  }
  long long tmp = 0;
  for (long long i = 0; i < (61); i++) {
    long long x = one[i];
    tmp += (((x * (x - 1) / 2) % MOD) * pw2[i]) % MOD;
    tmp %= MOD;
  }
  long long ans = (sum * (N - 1)) % MOD;
  ans -= tmp * 2;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
}
