#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b,
                    long long int m = 1000000007) {
  a %= m;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  long long int arr[n + 1];
  int count = 0;
  int v = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    if (arr[i]) {
      v = floor(log2(arr[i])) + 1;
      count = max(count, v);
    }
  }
  long long int ans = 0;
  for (int i = 0; i < count; i++) {
    int zo = 0, x1 = 0;
    for (int j = 1; j <= n; j++) {
      if ((arr[j] >> i) & 1) {
        x1++;
      } else {
        zo++;
      }
    }
    long long int s = power(2, i);
    ans += ((x1 * zo) % 1000000007) * (s % 1000000007);
    ans %= 1000000007;
  }
  cout << ans;
}
