#include <bits/stdc++.h>
using namespace std;
long long cnt0[69], cnt1[69];
int main() {
  long long n;
  long long a[300009];
  long long ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j <= 60; j++) {
      if ((a[i] >> j) & 1) {
        ans += cnt0[j] * (1ll << j) % 1000000007;
        ans %= 1000000007;
        cnt1[j]++;
      } else {
        ans += cnt1[j] * (1ll << j) % 1000000007;
        ans %= 1000000007;
        cnt0[j]++;
      }
    }
  }
  cout << ans << endl;
  return (0);
}
