#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0, base = 1;
  for (int i = 0; i < 70; i++) {
    long long cnt0 = 0, cnt1 = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & (1LL << i))
        cnt1++;
      else
        cnt0++;
    }
    ans += base * cnt0 * cnt1;
    ans %= MOD;
    base *= 2;
    base %= MOD;
  }
  cout << (ans) << endl;
}
