#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
unsigned long long n;
unsigned long long d[((unsigned long long)3e5 + 5)];
unsigned long long ct[((unsigned long long)3e5 + 5)];
bool bt(unsigned long long x, unsigned long long idx) { return (x >> idx) % 2; }
string bin(unsigned long long x) {
  string res;
  while (x > 0) {
    res += ('0' + x % 2);
    x /= 2;
  }
  string rev;
  for (int i = res.size() - 1; i >= 0; --i) rev += res[i];
  return rev;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (unsigned long long i = 0; i < n; ++i) {
    cin >> d[i];
    for (int j = 0; j < 63; ++j) ct[j] += bt(d[i], j);
  }
  unsigned long long ans = 0;
  for (unsigned long long i = 0; i < 63; ++i) {
    if (false)
      cerr << "i"
           << " = " << i << " | "
           << "ct[i]"
           << " = " << ct[i] << "\n";
    ;
    ans = (ans + (((ct[i] * (n - ct[i])) % ((unsigned long long)1e9 + 7)) *
                  (1 << (i)))) %
          ((unsigned long long)1e9 + 7);
  }
  cout << ans << "\n";
}
