#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long mod = 1000000007;
  long long res = 0;
  for (int i = 0; i < 61; i++) {
    int no0 = 0, no1 = 0;
    for (int j = n - 1; j >= 0; j--) {
      int bit = (a[j] >> i) & 1;
      if (bit == 1) {
        res = (res + (1LL << i) * no0 % mod) % mod;
        no1++;
      } else {
        res = (res + (1LL << i) * no1 % mod) % mod;
        no0++;
      }
    }
  }
  cout << res << "\n";
  return 0;
}
