#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  vector<long long> a0(60), a1(60);
  long long ans = 0, keisu = 1;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 60; j++) {
      if (a.at(i) & ((long long)1 << j))
        a1.at(j)++;
      else
        a0.at(j)++;
    }
  }
  for (long long i = 0; i < 60; i++) {
    ans += a0.at(i) * a1.at(i) * keisu;
    ans %= 1000000007;
    keisu *= 2;
  }
  cout << ans << endl;
}
