#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[300005];
int main() {
  cin >> n;
  long long maxi = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    maxi = max(maxi, a[i]);
  }
  long long ans = 0;
  for (long long t = 0; t < 60; t++) {
    long long x = pow(2, t);
    long long zero = 0, one = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] & x) {
        one += 1;
      } else {
        zero += 1;
      }
    }
    long long c = (one * zero) % 1000000007;
    ans += (x * c) % 1000000007;
    ans = ans % 1000000007;
  }
  cout << ans << endl;
  ;
}
