#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 1e9 + 7;
  cin >> n;
  vector<int64_t> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> one(61);
  for (int i = 0; i < n; i++) {
    bitset<61> bs(a[i]);
    for (int j = 0; j < 61; j++) {
      one[j] += bs[j];
    }
  }
  int64_t ans = 0;
  for (int i = 0; i < 61; i++) {
    ans += (int64_t)pow(2, i) % m * (int64_t)(one[i] * (n - one[i]) % m);
    ans %= m;
  }
  cout << ans << endl;
}
