#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[n + 1];
  long long a_max = -1;
  for (long long i = 1; i <= (long long)(n); i++) {
    cin >> a[i];
    a_max = max(a[i], a_max);
  }
  long long tmp = 1;
  long long mod = 1e9 + 7;
  long long count = 0;
  for (long long i = 0; i <= (long long)(60); i++) {
    long long count1 = 0;
    for (long long j = 1; j <= (long long)(n); j++) {
      if ((a[j] >> i) & 1) {
        count1++;
      }
    }
    count += tmp * (count1 * (n - count1));
    tmp *= 2;
  }
  count %= mod;
  cout << count << endl;
  return 0;
}
