#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[n + 1];
  long long a_max = -1;
  for (int i = 1; i <= (long long)(n); i++) {
    cin >> a[i];
    a_max = max(a[i], a_max);
  }
  double count = 0;
  for (int i = 0; i <= (long long)(59); i++) {
    long long count0 = 0;
    long long count1 = 0;
    for (int j = 1; j <= (long long)(n); j++) {
      if ((a[j] >> i) & 1) {
        count1++;
      } else {
        count0++;
      }
    }
    count += pow((double)2, (double)i) * (count1 * count0);
  }
  cout << (long long)fmod(count, pow(10, 9) + 7) << endl;
  return 0;
}
