#include <bits/stdc++.h>
using namespace std;
long long a[300005], mod = 1e9 + 7, r[65];
int main() {
  long long n, ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 60; j >= 0; j--) {
      if ((a[i] >> j) & 1) r[j]++;
    }
  }
  for (int i = 0; i <= 60; i++) {
    long long num = r[i] * (n - r[i]) % mod;
    ans = (ans + (num << i)) % mod;
  }
  cout << ans << endl;
}
