#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  auto max_elm = max_element(a.begin(), a.end());
  int keta = log2(*max_elm);
  vector<vector<long long>> m(keta + 1, vector<long long>(2, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= keta; j++) {
      if (a[i] & (1ll << j)) {
        m[j][1] += 1;
      } else {
        m[j][0] += 1;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i <= keta; i++) {
    ans += (long long)pow((long long)2, i) * (long long)m[i][0] *
           (long long)m[i][1];
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
