#include <bits/stdc++.h>
using namespace std;
int64_t freq[60];
int64_t sum[60];
int main() {
  int n;
  cin >> n;
  vector<int64_t> ar;
  for (int i = 0; i < n; i++) {
    int64_t a;
    cin >> a;
    for (int j = 0; j < 60; j++) {
      freq[j] += (a >> j) & 1;
    }
    ar.push_back(a);
  }
  for (auto s : ar) {
    for (int j = 0; j < 60; j++) {
      if ((s >> j) & 1) {
        sum[j] += n - freq[j];
        freq[j]--;
      } else {
        sum[j] += freq[j];
      }
    }
    n--;
  }
  int64_t ans = 0;
  for (int i = 0; i < 60; i++) {
    int64_t p2 = (1 << i) % 1000000007;
    sum[i] = sum[i] % 1000000007;
    int64_t rs = (p2 * sum[i]) % 1000000007;
    ans = (ans + rs) % 1000000007;
  }
  cout << ans << endl;
}
