#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < (60); i++) {
    vector<int> num(2, 0);
    for (int j = 0; j < (n); j++) num[(a[j] >> i) & 1]++;
    ans = (ans + (((long long)num[0] * num[1]) % 1000000007) *
                     ((1 << i) % 1000000007)) %
          1000000007;
  }
  cout << ans << "\n";
}
