#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = (1e9 + 7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long factorial(long long n, long long m = 2) {
  m = max(2LL, m);
  long long rtn = 1;
  for (long long i = m; i <= n; i++) {
    rtn = (rtn * i) % MOD;
  }
  return rtn;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
template <class Abel>
struct BIT {
  const Abel UNITY_SUM = 0;
  vector<Abel> dat;
  BIT(int n) : dat(n + 1, UNITY_SUM) {}
  void init(int n) { dat.assign(n + 1, UNITY_SUM); }
  inline void add(int a, Abel x) {
    for (int i = a; i < (int)dat.size(); i += i & -i) dat[i] = dat[i] + x;
  }
  inline Abel sum(int a) {
    Abel res = UNITY_SUM;
    for (int i = a; i > 0; i -= i & -i) res = res + dat[i];
    return res;
  }
  inline Abel sum(int a, int b) { return sum(b - 1) - sum(a - 1); }
};
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<long long> cnt(60, 0);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 60; ++j) {
      if (a[i] & 1ll << j) cnt[j]++;
    }
  }
  long long ans = 0;
  for (int b = 0; b < 60; ++b) {
    ans += cnt[b] * (n - cnt[b]) << b;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
