#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  long long int p = (long long int)(1e9 + 7);
  cin >> n;
  vector<long long int> arr(n + 1);
  for (long long int i = 1; i <= n; i++) cin >> arr[i];
  vector<long long int> set(62, 0);
  vector<long long int> unset(62, 0);
  for (long long int i = 0; i < 62; i++) {
    for (long long int j = 1; j <= n; j++) {
      if ((arr[j] & (1l << i)) > 0)
        set[i]++;
      else
        unset[i]++;
    }
  }
  long long int ans = 0;
  for (int i = 0; i < 62; i++) {
    ans = (ans % p + ((set[i] % p * unset[i] % p) % p * (1l << i) % p) % p) % p;
  }
  cout << ans << endl;
}
