#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template <class T>
using P = pair<T, T>;
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;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
ll modpow(ll a, ll b, ll M) {
  ll res = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) res = (res * a) % M;
    a = a * a % M;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  VL a(n);
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
  }
  ll ans = 0;
  for (int bit = 0; bit < (61); bit++) {
    int zero = 0;
    int one = 0;
    for (int i = 0; i < (n); i++) {
      (1 & (a[i] >> bit)) ? one++ : zero++;
    }
    ll bits = modpow(2, bit, MOD);
    ans += bits * (zero * one % MOD);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
