#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  long long sum = 0;
  for (int i = 0; i < 64; i++) {
    long long s1 = 0;
    long long int one = 0, zero = 0;
    for (int j = 0; j < n; j++) {
      if (v[j] % 2)
        one += 1;
      else
        zero += 1;
      v[j] = v[j] / 2;
    }
    s1 = ((one * zero) % mod * ((long long)1 << i) % mod) % mod;
    sum = (sum % mod + s1 % mod) % mod;
  }
  cout << sum % mod;
}
