#include <bits/stdc++.h>
using namespace std;
const long long Maxn = 2019;
const long double pi = acos(-1);
const long long mod = 1000000007;
template <class T>
ostream &operator<<(ostream &out, vector<T> &A) {
  for (auto x : A) out << x << endl;
  return out;
}
template <class T>
ostream &operator<<(ostream &out, set<T> &A) {
  for (auto x : A) out << x << " ";
  return out;
}
template <class T1, class T2>
T1 powr(T1 a, T2 b) {
  T1 res = 1;
  for (long long i = 1; i < b + 1; i++) res = res * a;
  return res;
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, ans = 0;
  cin >> n;
  vector<long long> A(n);
  for (long long i = 0; i < n; i++) cin >> A[i];
  for (long long i = 60; i >= 0; i--) {
    long long zer = 0, one = 0;
    for (long long x : A) {
      if ((x >> i) & 1)
        one++;
      else
        zer++;
    }
    ans += (((one * zer) % mod) * ((long long)1 << i) % mod) % mod;
  }
  cout << (ans) << endl;
  return 0;
}
