#include <bits/stdc++.h>
using namespace std;
using bigint = long long int;
using vi = vector<int>;
bigint arr[300001];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> arr[i];
  bigint ans = 0;
  bigint two = 1;
  for (bigint i = 0; i < 61; i++) {
    bigint set = 0;
    for (int j = 0; j < N; j++) {
      if ((arr[j] >> i) & 1) set++;
    }
    bigint A = set * (N - set);
    ans += A * two;
    ans %= 1000000007;
    two = two * 2 % 1000000007;
  }
  cout << ans << "\n";
  return 0;
}
