#include <bits/stdc++.h>
using namespace std;
int main() {
  long N = 0;
  long long A[300001] = {0};
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  for (int i = 0; i < 61; i++) {
    int count0 = 0, count1 = 0;
    for (int j = 0; j < N; j++) {
      if ((A[j] >> i) & 1) {
        count1 += 1;
      } else {
        count0 += 1;
      }
    }
    if (i < 25) {
      ans = ans + ((long long)1 << i) * count1 * count0;
    } else {
      ans = ans + (((long long)1 << i) % 1000000007) * count1 * count0;
    }
    ans = ans % 1000000007;
  }
  cout << ans;
  return 0;
}
