#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 7;
const long long mod = 1e9 + 7;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> cnt(60);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    for (long long j = 0; j < 60; ++j) {
      if (a[i] & (1ll << j)) {
        ++cnt[j];
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 60; ++i) {
    long long cur = cnt[i] * (n - cnt[i]);
    for (long long k = 0; k < i; ++k) {
      cur *= 2ll;
    }
    ans += cur;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
