#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
bool chkbit(long long n, long long k) { return n & (1LL << k); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < 61; i++) {
    long long cnt = 0;
    for (auto x : a) cnt += chkbit(x, i);
    long long tmp = (cnt * (n - cnt));
    ans += (tmp * (1LL << i));
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
