#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n;
  cin >> n;
  unsigned long long a[n + 5];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  unsigned long long res = 0;
  for (unsigned long long i = 0; i < 60; i++) {
    long long c0 = 0, c1 = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & (1ULL << i)) {
        c1++;
      } else {
        c0++;
      }
    }
    res = (res + c1 * c0 % 1000000007 * (1ULL << i) % 1000000007) % 1000000007;
  }
  cout << res << endl;
}
