#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<ll> num(n);
  for (int i = 0; i < n; i++) {
    cin >> num[i];
  }
  ll ans = 0;
  for (int i = 61; i >= 0; i--) {
    ll m = pow(2, i), c0 = 0, c1 = 0;
    for (int j = 0; j < n; j++) {
      if (num[j] >= m) {
        c1++;
        num[j] %= m;
      } else {
        c0++;
      }
    }
    ans += m * c0 * c1;
    ans %= MOD;
  }
  cout << ans << endl;
}
