#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  while (cin >> n) {
    long long cnt[65];
    memset(cnt, 0, sizeof cnt);
    for (long long i = 0; i < n; i++) {
      long long x;
      cin >> x;
      for (long long i = 0; i <= 60; i++) {
        if (x & (1LL << i)) cnt[i]++;
      }
    }
    long long ans = 0;
    long long p = 1;
    for (long long i = 0; i <= 60; i++) {
      long long temp = cnt[i] * (n - cnt[i]);
      ans = (ans + (temp * p) % 1000000007) % 1000000007;
      p = (2 * p);
    }
    cout << ans << "\n";
  }
  return 0;
}
