#include <bits/stdc++.h>
using namespace std;
long long cnt[61];
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    for (long long j = 0; j <= 59; j++) {
      if ((a[i] >> j) % 2) cnt[j]++;
    }
  }
  long long cur = 1, ans = 0;
  for (long long i = 0; i <= 59; i++) {
    ans += cur * cnt[i] * (n - cnt[i]);
    ans %= 1000000007;
    cur *= 2;
    cur %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
