#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  vector<long long> d(100, 1);
  for (long long i = 1; i < 100; ++i) d[i] = (d[i - 1] * 2) % mod;
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) cin >> a[i];
  long long ans = 0;
  for (long long j = 0; j < 60; ++j) {
    long long sum = 0;
    for (long long i = 0; i < n; ++i) {
      if (a[i] & (1ll << j)) {
        ++sum;
      }
    }
    ans += sum * (n - sum) * d[j];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
