#include <bits/stdc++.h>
using namespace std;
long long int beki(long long int a, long long int b) {
  long long int ans = 1;
  int t = 0;
  long long int beki2[70];
  beki2[0] = a;
  for (int i = 1; i < 70; i++) {
    beki2[i] = (beki2[i - 1] * beki2[i - 1]) % 1000000007;
  }
  while ((1 << t) < b) {
    if (b & (1 << t)) {
      ans = (ans * beki2[t]) % 1000000007;
    }
  }
  return ans;
}
int main() {
  long long int count[60][2];
  for (int i = 0; i < 60; i++) {
    count[i][0] = 0LL;
    count[i][1] = 0LL;
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    for (int j = 0; j < 60; j++) {
      if (a & (1LL << j)) {
        count[j][1]++;
      } else {
        count[j][0]++;
      }
    }
  }
  long long int ans = 0LL;
  for (int i = 0; i < 60; i++) {
    long long int temp =
        (count[i][0] * count[i][1] % 1000000007) * (1LL << i) % 1000000007;
    ans = (ans + temp) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
