#include <bits/stdc++.h>
using namespace std;
int dy[8] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long long mod = 1000000007;
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long res = 0;
  for (int i = 0; i < 60; i++) {
    long long cnt = 0;
    for (auto it : a) {
      if (it & (1ll << i)) {
        cnt++;
      }
    }
    res += (1ll << i) % mod * cnt * (n - cnt) % mod;
  }
  cout << res % mod << endl;
}
