#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans = 0;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) cin >> a.at(i);
  for (long long i = 0; i < (60); i++) {
    int cnt0 = 0, cnt1 = 0;
    for (long long j = 0; j < (n); j++) {
      if ((1LL << i) & a.at(j))
        cnt1++;
      else
        cnt0++;
    }
    ans += ((1LL << i) % (long long)(1e9 + 7)) * (cnt1 % (long long)(1e9 + 7)) *
           (cnt0 % (long long)(1e9 + 7));
    ans %= (long long)(1e9 + 7);
  }
  cout << ans % (long long)(1e9 + 7) << endl;
}
