#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];
  }
  int maxbit = log(*max_element(a.begin(), a.end())) / log(2) + 1;
  maxbit = 60;
  long long ans = 0;
  for (int i = 0; i < maxbit; i++) {
    long long bits[2] = {};
    for (int j = 0; j < n; j++) {
      if (a[j] & (1LL << i)) {
        bits[1]++;
      } else {
        bits[0]++;
      }
    }
    ans = (ans % 1000000007 +
           (1LL * bits[0] * bits[1]) % 1000000007 * (1LL << i) % 1000000007) %
          1000000007;
  }
  cout << ans % 1000000007 << endl;
}
