#include <bits/stdc++.h>
using namespace std;
template <class T>
inline int out(const T &t) {
  print(t);
  putchar('\n');
  return 0;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return (gcd(b, a % b));
}
template <class T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
const long long INF = 1e18;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long MOD = 1000000007;
void solve_TLE(long long N, std::vector<long long> A) {
  long long sum = 0;
  for (long long i = 0; i < N; i++) {
    for (long long j = i + 1; j < N; j++) {
      sum += A[i] ^ A[j];
      sum %= MOD;
    }
  }
  cout << sum << "\n";
}
void solve(long long N, std::vector<long long> A) {
  long long sum = 0;
  for (long long i = 0; i <= 60; i++) {
    long long dgt = 1LL << i;
    dgt %= MOD;
    long long cnt = 0;
    for (long long j = 0; j < N; j++) {
      if ((A[j] >> i) & 1) cnt++;
    }
    long long val = (dgt * (cnt * (N - cnt)) % MOD) % MOD;
    sum += val;
    sum %= MOD;
  }
  cout << sum << "\n";
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}
