#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
using namespace std;
template <class T>
ostream &operator<<(ostream &str, vector<T> &a) {
  for (auto &i : a) {
    str << i << " ";
  }
  return str;
}
template <class T>
istream &operator>>(istream &str, vector<T> &a) {
  for (auto &i : a) {
    str >> i;
  }
  return str;
}
template <class T>
ostream &operator<<(ostream &str, pair<T, T> &a) {
  str << a.first << " " << a.second;
  return str;
}
template <class T>
istream &operator>>(istream &str, pair<T, T> &a) {
  str >> a.first >> a.second;
  return str;
}
void solve();
signed main() {
  srand(time(0));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(6);
  solve();
  return 0;
}
const long long MOD = 1e9 + 7;
long long cnt1[65], cnt0[65];
void solve() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    long long num;
    cin >> num;
    for (long long j = 0; j < 60; ++j) {
      if ((num >> j) & 1) {
        cnt1[j]++;
      } else {
        cnt0[j]++;
      }
    }
  }
  long long ans = 0;
  long long p = 1;
  for (long long i = 0; i < 64; ++i) {
    ans = (ans + (p * cnt1[i] % MOD) * cnt0[i] % MOD) % MOD;
    p *= 2;
  }
  cout << ans << '\n';
}
