#include <bits/stdc++.h>
using namespace std;
long long n;
void solve() {
  cin >> n;
  long long a;
  long long o[100] = {0};
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> a;
    for (long long j = 0; j <= 61; ++j) {
      if ((a >> j) & 1) {
        ++o[j];
      }
    }
  }
  for (long long i = 0; i <= 61; ++i) {
    long long x = o[i] * (n - o[i]);
    if (x != 0) {
      x *= (1LL << i);
      x %= 1000000007LL;
      ans += x;
      ans %= (1000000007LL);
    }
  }
  cout << ans << "\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
