#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, ans = 0;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = 0; i < 60; i++) {
    long long count = 0;
    for (long long i = 0; i < n; i++) count += (v[i] >> i & 1);
    count = (count * (n - count)) % 1000000007;
    for (long long j = 0; j < i; j++) count *= 2, count %= 1000000007;
    ans += count, ans %= 1000000007;
  }
  cout << ans;
}
