#include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const long long int inf = 1e15;
const long long int MOD = 1e9 + 7;
const long long int N = 2e5 + 5;
long long int a[N], sum[N];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  long long int ans = 0;
  for (long long int i = 0; i < 60; i++) {
    long long int o = 0, z = 0;
    for (long long int j = 1; j <= n; j++) {
      if (a[j] & (1ll << i))
        o++;
      else
        z++;
    }
    ans += ((o * z) % MOD * ((1ll << i) % MOD)) % MOD;
    ans %= MOD;
  }
  cout << ans << '\n';
  return 0;
}
