#include <bits/stdc++.h>
constexpr long long int INF = std::numeric_limits<long long int>::max();
constexpr long long int NINF = std::numeric_limits<long long int>::min();
using namespace std;
long long int one[60];
void countup(long long int n) {
  for (long long int i = 0; i < 60 && n > 0; i++) {
    if (n & 1) {
      one[i]++;
    }
    n >>= 1;
  }
}
void solve() {
  long long int N;
  cin >> N;
  for (long long int i = 0; i < N; i++) {
    long long int a;
    cin >> a;
    countup(a);
  }
  long long int ans = 0;
  long long int base = 1;
  for (long long int i = 0; i < 60; i++) {
    long long int n = one[i] * (N - one[i]);
    ans += (base * n) % 1000000007;
    ans %= 1000000007;
    base = (base * 2) % 1000000007;
  }
  cout << ans << endl;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
