#include <bits/stdc++.h>
using namespace std;
const long long INF = LLONG_MAX / 4;
const int n_max = 1e5 + 10;
const long long MOD = 1e9 + 7;
void print() { cout << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << ' ';
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T>& vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << ' ';
  }
  cout << endl;
}
template <class T>
void print(vector<vector<T>>& df) {
  for (auto& vec : df) {
    print(vec);
  }
}
template <typename T>
void print(T& arr) {
  long long sz = sizeof(arr) / sizeof(arr[0]);
  for (int i = 0; i < sz - 1; i++) {
    cout << arr[i] << ' ';
  }
  cout << arr[sz - 1] << endl;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (long long)(n); i++) cin >> a[i];
  vector<long long> bt(62, 0);
  for (long long i = 0; i < (long long)(n); i++) {
    for (long long j = 0; j < (long long)(62); j++) {
      if ((a[i] >> j) & 1) bt[j]++;
    }
  }
  long long res = 0;
  for (long long i = 0; i < (long long)(62); i++) {
    long long base = 1LL << i;
    base %= MOD;
    res = (res + (base * bt[i] * (n - bt[i]) % MOD)) % MOD;
  }
  cout << res << endl;
}
