#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long int a[n], ans = 0, x = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 63; i++) {
    long long int a1 = 0, b = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & x) {
        a1++;
      } else
        b++;
    }
    a1 = a1 * b;
    a1 = a1 * x;
    x = x * 2;
    ans = (ans + a1) % 1000000007;
  }
  cout << ans << '\n';
}
