#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = acos(-1.0);
template <typename T>
inline T sq(T a) {
  return a * a;
}
template <typename T1, typename T2>
inline pair<T1, T2> mp(T1 a, T2 b) {
  return make_pair(a, b);
}
template <typename T1, typename T2>
inline T1 safeMod(T1 a, T2 m) {
  return (a % m + m) % m;
}
template <typename T1, typename T2>
inline bool isEq(T1 a, T2 b) {
  return abs(a - b) < EPS;
}
template <typename T1, typename T2, typename T3>
inline bool isEq(T1 a, T2 b, T3 eps) {
  return abs(a - b) < eps;
}
template <typename T>
inline bool isKthBitOn(T n, int k) {
  assert(n <= numeric_limits<T>::max());
  assert(k <= numeric_limits<T>::digits);
  T ONE = 1;
  return bool((n & (ONE << k)));
}
template <typename T>
inline void setKthBit(T& n, int k) {
  assert(n <= numeric_limits<T>::max());
  assert(k <= numeric_limits<T>::digits);
  T ONE = 1;
  n = (n | (ONE << k));
}
const int oo = 0x3f3f3f3f;
const int MAX = 200010;
const int MOD = 1000000007;
const int precision = 10;
int sum[MAX][64];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<long long> v(n);
  for (long long& x : v) cin >> x;
  for (int i = 0; i < n; i++) {
    for (long long j = 0; j < 62; j++) {
      if (isKthBitOn(v[i], j)) sum[i][j] = 1;
    }
  }
  vector<int> bitsum(62);
  for (long long j = 0; j < 62; j++) {
    int ss = 0;
    for (int i = 0; i < n; i++) {
      ss += sum[i][j];
    }
    bitsum[j] = ss;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    for (long long j = 0; j < 62; j++) {
      if (isKthBitOn(v[i], j)) {
        ans = (ans + (1LL << j) % MOD * (n - bitsum[j]) % MOD) % MOD;
      } else {
        ans = (ans + (1LL << j) % MOD * bitsum[j] % MOD) % MOD;
      }
    }
  }
  cout << ans / 2 << '\n';
  return 0;
}
