#include <bits/stdc++.h>
using namespace std;
int main() {
  const long mod = 1000000007;
  int N;
  cin >> N;
  vector<long> zeros(61, 0);
  vector<long> ones(61, 0);
  for (int i = 0; i < N; i++) {
    long val;
    cin >> val;
    for (int i = 0; i < 61; i++) {
      if ((val & ((long)1 << i))) {
        ones[i]++;
      } else {
        zeros[i]++;
      }
    }
  }
  long ans = 0;
  for (int i = 0; i < 61; i++) {
    ans += ((((long)(zeros[i] % mod) * (ones[i])) % mod) << i);
    ans = ans % mod;
  }
  cout << ans << endl;
}
