#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int main() {
  long long n;
  long long a[300010];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (int i = 0; i <= 60; i++) {
    long long box1 = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & (1LL << i)) {
        box1++;
      }
    }
    long long box0 = n - box1;
    long long tmp = (box1 * box0 % MOD * (1LL << i) % MOD) % MOD;
    ans = (ans + tmp) % MOD;
  }
  cout << ans << endl;
}
