#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> keta(60);
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    bitset<60> s(a);
    for (int i = 0; i < 60; i++) {
      if (s[i] == 1) {
        keta[i] += 1;
      }
    }
  }
  long long count = 0;
  for (int i = 0; i < 60; i++) {
    count = (count + (keta[i] * (n - keta[i]) *
                      ((long long)(pow(2, i)) % 1000000007))) %
            1000000007;
  }
  cout << count << endl;
}
