#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC target("tune=native")
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using str = string;
using pll = pair<ll, ll>;
template <class T>
void chMax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void chMin(T &a, T b) {
  if (b < a) a = b;
}
inline ll divUp(ll a, ll b) { return (a + b - 1) / b; }
bool bit(ll m, ll v) { return (m >> v) & 1; }
void solve() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (auto &it : a) cin >> it;
  ll cnt[2][64];
  memset(cnt, 0, sizeof(cnt));
  ll s = 0;
  for (auto &it : a) {
    for (ll i = 0; i < 64; i++) {
      if (bit(it, i)) {
        s = (s + (1LL << i) * cnt[0][i]) % 1000000007LL;
        cnt[1][i]++;
      } else {
        s = (s + (1LL << i) * cnt[1][i]) % 1000000007LL;
        cnt[0][i]++;
      }
    }
  }
  cout << s << "\n";
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  solve();
  return 0;
}
