#include <bits/stdc++.h>
using namespace std;
int main() {
  int mod = 1e9 + 7;
  int n;
  cin >> n;
  vector<long long> arr(n);
  vector<int> ct(61, 0);
  for (int i = 0; i < n; ++i) {
    long long curr;
    cin >> curr;
    arr[i] = curr;
    for (int j = 0; j < 61; ++j) {
      if (((1LL << j) & curr) > 0) {
        ct[j]++;
      }
    }
  }
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    long long curr = arr[i];
    for (int j = 0; j < 61; ++j) {
      if (((1LL << j) & curr) > 0) {
        res += (n - ct[j]) * (1LL << j);
        res %= mod;
      } else {
        res += ct[j] * (1LL << j);
        res %= mod;
      }
    }
  }
  cout << res / 2 << endl;
  return 0;
}
