#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
void test_case() {
  long long n;
  cin >> n;
  vector<long long> bit(61);
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    for (long long b = 0; b < 60; b++) {
      if (x & ((long long)1 << b)) bit[b]++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    ans = (ans + (((long long)1 << i) * bit[i]) % mod * (n - bit[i])) % mod;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) test_case();
}
