#include <bits/stdc++.h>
using namespace std;
long long n, a;
void solve() {
  cin >> n;
  long long a;
  long long o[100] = {0}, z[100] = {0};
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> a;
    for (long long j = 0; j < 60; ++j) {
      if ((a >> j) & 1) {
        ++o[j];
      } else
        ++z[j];
    }
  }
  for (long long i = 0; i < 60; ++i) {
    long long x = o[i] * z[i];
    x *= (1LL << i) % 1000000007;
    ans += x;
    ans %= (1000000007);
  }
  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;
}
