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