#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long ans = 0;
  long long k = 0;
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < n; j++)
      if ((arr[j] & (1LL << i))) k++;
    ans += ((1LL << i) * (k * (n - k)));
    ans %= mod;
  }
  cout << (ans) << endl;
}
