#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int x = 0; x < n; x++) cin >> a[x];
  long long int s[61][2];
  memset(s, 0, sizeof(s));
  long long int ans = 0;
  for (long long int x = n - 1; x >= 0; x--) {
    long long int g = a[x];
    for (long long int y = 0; y < 60; y++) {
      if (g & (1ll << y)) {
        ans += (s[y][0] * (1ll << y)) % 1000000007;
        ans %= 1000000007;
      } else {
        ans += (s[y][1] * (1ll << y)) % 1000000007;
        ans %= 1000000007;
      }
    }
    for (long long int y = 0; y < 60; y++) {
      if (g & (1ll << y))
        ++s[y][1];
      else
        ++s[y][0];
    }
  }
  cout << ans % 1000000007;
}
