#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long mod_pow(long long x, long long n) {
  long long ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return ret;
}
void solve(long long N, std::vector<long long> A) {
  long long ans = 0;
  for (int i = 0; i < (60); ++i) {
    int zero_count = 0;
    int one_count = 0;
    for (int j = 0; j < (N); ++j) {
      bitset<60> s(A[j]);
      if (s.test(i)) {
        one_count++;
      } else {
        zero_count++;
      }
    }
    ans += zero_count * one_count * mod_pow(2, i);
    ans %= MOD;
  }
  cout << ans << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}
