#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
void CINT() {}
template <class Head, class... Tail>
void CINT(Head &&head, Tail &&...tail) {
  cin >> head;
  CINT(move(tail)...);
}
void OUT() {}
template <class Head, class... Tail>
void OUT(Head &&head, Tail &&...tail) {
  cout << head << (sizeof...(tail) ? " " : "\n");
  OUT(move(tail)...);
}
template <typename TypeInt>
TypeInt GCD(TypeInt a, TypeInt b) {
  return a % b == 0 ? b : GCD(b, a % b);
}
template <typename TypeInt>
TypeInt LCM(TypeInt a, TypeInt b) {
  return a * b / GCD(a, b);
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool comp(T a, T b) {
  return abs(a) < abs(b);
}
void YES(bool f) { printf(f ? "YES\n" : "NO\n"); }
void Yes(bool f) { printf(f ? "Yes\n" : "No\n"); }
void Possible(bool f) { printf(f ? "Possible\n" : "Impossible\n"); }
void POSSIBLE(bool f) { printf(f ? "POSSIBLE\n" : "IMPOSSIBLE\n"); }
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int NMAX = 55;
const int INF = 1e9;
const int MOD = 1e9 + 7;
bool flag;
signed main() {
  int N;
  CINT(N);
  vector<long long> A(N);
  for (auto &item : A) cin >> item;
  long long ans = 0;
  for (int i = 0; i < (int)(60); i++) {
    long long cnt = 0;
    for (int j = 0; j < (int)(N); j++) {
      if (A[j] >> i & 1) cnt++;
    }
    long long tmp = (1LL << i) % MOD;
    ans += tmp * (cnt * (N - cnt)) % MOD;
    ans %= MOD;
  }
  OUT(ans);
  return 0;
}
