#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e14;
const long long ZERO = 0;
const long long MOD = 1000000007;
const double PI = 3.1415926535897;
signed main() {
  long long N;
  cin >> N;
  vector<long long> vec(N);
  for (long long i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  vector<vector<long long>> d(N, vector<long long>(60));
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < 60; j++) {
      if (vec.at(i) & 1ll << j) {
        d[i][j] = 1;
      } else {
        d[i][j] = 0;
      }
    }
  }
  vector<long long> cnt(60);
  for (long long i = 0; i < 60; i++) {
    long long zero = 0;
    long long one = 0;
    for (long long j = 0; j < N; j++) {
      if (d[j][i] == 0) {
        zero++;
      } else {
        one++;
      }
    }
    cnt[i] = zero * one;
  }
  long long ret = 0;
  for (long long i = 0; i < 60; i++) {
    long long a = cnt[i] * (1ll << i);
    ret += a;
    ret = ret % MOD;
  }
  cout << ret << endl;
}
