#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  long long count[60] = {0};
  for (int i = 0; i < n; i++) {
    long long x = 1;
    for (int j = 0; j < 60; j++) {
      if ((a[i] & (x << j)) != 0) {
        count[j]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      long long x = 1;
      if ((a[i] & (x << j)) != 0) {
        long long p = (x << j) % 1000000007;
        ans = (ans + (p * (n - count[j])) % 1000000007) % 1000000007;
      } else {
        long long p = (x << j) % 1000000007;
        ans = (ans + (p * (count[j])) % 1000000007) % 1000000007;
      }
    }
  }
  cout << ans / 2 << "\n";
  return 0;
}
