#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0, i_len = (n); i < i_len; ++i) {
    cin >> a[i];
  }
  vector<long long> cnt1(60, 0), cnt0(60, 0);
  for (long long i = 0, i_len = (n); i < i_len; ++i) {
    for (long long j = 0, j_len = (60); j < j_len; ++j) {
      if (a[i] & (1ll << j))
        cnt1[j]++;
      else
        cnt0[j]++;
    }
  }
  long long ans = 0;
  for (long long i = 0, i_len = (60); i < i_len; ++i) {
    ans += cnt1[i] % 1000000007 * cnt0[i] % 1000000007 * (long long)powl(2, i) %
           1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
