#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long n, ans = 0;
  cin >> n;
  vector<long long> a(n), b(60, 0);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 60; j++) {
      if (a[i] & (1LL << j)) {
        b[j]++;
      }
    }
  }
  for (long long i = 0; i < 60; i++) {
    ans += (b[i] * (1 << i) % MOD) * (n - b[i]) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
