#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> vec(61);
  long long cnt = 0;
  for (int i = 0; i < n; ++i) {
    long long t;
    cin >> t;
    long long idx = 0;
    while (t > 0) {
      if (t % 2 == 1) {
        vec[idx] += 1;
      }
      ++idx;
      t = t >> 1;
    }
    cnt = max(idx, cnt);
  }
  long long ans = 0;
  long long int num = 1;
  for (int i = 0; i < cnt; ++i) {
    ans += num * vec[i] * (n - vec[i]);
    ans %= 1000000007;
    num *= 2;
  }
  cout << ans << endl;
}
