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