#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  unsigned long long n;
  cin >> n;
  bitset<64> arr[n];
  for (unsigned long long i = 0; i <= n - 1; i++) {
    unsigned long long a;
    cin >> a;
    bitset<64> temp(a);
    arr[i] = temp;
  }
  unsigned long long ans = 0;
  for (unsigned long long j = 0; j <= 63; j++) {
    unsigned long long alpha = 0;
    unsigned long long beta = 0;
    for (unsigned long long i = 0; i <= n - 1; i++) {
      if (arr[i][j] == 1) {
        alpha++;
      } else {
        beta++;
      }
    }
    unsigned long long no_of_one = alpha * beta;
    unsigned long long local = (no_of_one * (unsigned long long)pow(2, j)) %
                               (unsigned long long)1000000007;
    ans = (ans + local) % 1000000007;
  }
  cout << ans << "\n";
  return 0;
}
