#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  long long p = power(a, b / 2) % 1000000007;
  p = (p * p) % 1000000007;
  if (b % 2 == 1) {
    p = ((a % 1000000007) * p) % 1000000007;
  }
  return p;
}
long long arr[300005];
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  long long ans = 0;
  for (long long i = 0; i < 61; ++i) {
    long long num0 = 0, num1 = 0;
    for (long long j = 0; j < n; ++j) {
      if ((arr[j] >> i) & 1) {
        num1++;
      } else {
        num0++;
      }
    }
    ans = (ans + num0 * num1 * power(2, i)) % 1000000007;
  }
  cout << ans << endl;
}
