#include <bits/stdc++.h>
using namespace std;
constexpr long long int MOD = 1000000007;
constexpr double EPS = 1e-8;
long long int N, M, K, H, W, L, R;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  vector<long long int> v(N);
  for (auto &i : v) cin >> i;
  for (int i = 0; i < 60; i++) {
    long long int odd = 0, even = 0;
    for (auto j : v) {
      if ((j >> i) & 1)
        odd++;
      else
        even++;
    }
    K = 1LL << i;
    K %= MOD;
    K *= (odd * even) % MOD;
    M += K;
  }
  cout << M << endl;
}
