#include <bits/stdc++.h>
using namespace std;
int n;
long long a[300005];
long long ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= 60; i++) {
    long long t = 0, f = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & ((long long)1 << i))
        t++;
      else
        f++;
    }
    ans = (ans + (t * (f * ((long long)1 << i) % 1000000007) % 1000000007) %
                     1000000007) %
          1000000007;
  }
  cout << ans << endl;
  return 0;
}
