#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
const long long MOD = 1e9 + 7;
long long a[N], suff[N][61];
int32_t main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = n; i >= 1; i--) {
    for (long long j = 0; j < 60; j++) {
      suff[i][j] = suff[i + 1][j];
      if (a[i] & (1LL << j)) suff[i][j] = suff[i + 1][j] + 1;
    }
  }
  long long ans = 0;
  for (long long i = 1; i < n; i++) {
    long long temp = 0;
    for (long long j = 0; j < 60; j++) {
      long long set = (a[i] & (1LL << j)) ? 1 : 0;
      if (set) {
        temp += (1LL << j) * (n - i - suff[i + 1][j]) % MOD;
      } else {
        temp += (1LL << j) * (suff[i + 1][j]) % MOD;
      }
    }
    ans += temp % MOD;
  }
  ans += MOD;
  ans %= MOD;
  cout << ans << "\n";
  return 0;
}
