#include <bits/stdc++.h>
using namespace std;
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr long long MOD = 1000000007;
using Graph = vector<vector<long long>>;
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  long long A[N];
  for (long long i = 0; i < (long long)(N); i++) cin >> A[i];
  long long bit[63]{};
  long long ans = 0;
  for (long long i = 0; i < (long long)(N); i++) {
    long long x = 2;
    for (long long j = 0; j < (long long)(63); j++) {
      if (A[i] % x != 0) {
        bit[j]++;
        A[i] -= x / 2;
        if (A[i] == 0) break;
      }
      x *= 2;
    }
  }
  long long x = 1;
  for (long long i = 0; i < (long long)(63); i++) {
    ans = (ans + x * ((bit[i] * (N - bit[i])) % MOD)) % MOD;
    x *= 2;
  }
  cout << ans << endl;
}
