#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int64_t>>;
const double pi = M_PI;
const uint64_t MOD = 1000000007;
int digits(uint64_t n) { return floor(log2l((long double)n)) + 1; }
int main() {
  int n;
  cin >> n;
  uint64_t a[n], ans = 0, m = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    m = max(m, a[i]);
  }
  int mr = digits(m);
  for (int i = 0; i < mr; i++) {
    uint64_t zero = 0, iti = 0;
    for (int k = 0; k < n; k++) {
      if ((a[k] >> i) & 1) {
        iti++;
      } else {
        zero++;
      }
    }
    ans += ((1LL << i) * ((zero * iti) % MOD)) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
