#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans = 0, p = powl(10, 9) + 7;
  cin >> n;
  long long a[300000];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i < (1LL << 60); i = i << 1) {
    long long b = 0, c = 0;
    for (long long j = 0; j < n; j++) {
      if ((a[j] & i) == 0) {
        b++;
      } else {
        c++;
      }
    }
    ans = (ans + (b * c) % p * i % p) % p;
  }
  cout << ans << endl;
}
